]>
git.ipfire.org Git - thirdparty/git.git/blob - t/t5801/git-remote-testgit
2 # Copyright (c) 2012 Felipe Contreras
4 # The first argument can be a url when the fetch/push command was a url
5 # instead of a configured remote. In this case, use a generic alias.
6 if test "$1" = "testgit::$2"; then
13 dir
="$GIT_DIR/testgit/$alias"
15 if ! git rev-parse
--is-inside-git-dir
20 h_refspec
="refs/heads/*:refs/testgit/$alias/heads/*"
21 t_refspec
="refs/tags/*:refs/testgit/$alias/tags/*"
23 if test -n "$GIT_REMOTE_TESTGIT_NOREFSPEC"
36 if test -z "$GIT_REMOTE_TESTGIT_NO_MARKS"
38 gitmarks
="$dir/git.marks"
39 testgitmarks
="$dir/testgit.marks"
40 test -e "$gitmarks" ||
>"$gitmarks"
41 test -e "$testgitmarks" ||
>"$testgitmarks"
50 test -n "$h_refspec" && echo "refspec $h_refspec"
51 test -n "$t_refspec" && echo "refspec $t_refspec"
52 if test -n "$gitmarks"
54 echo "*import-marks $gitmarks"
55 echo "*export-marks $gitmarks"
57 test -n "$GIT_REMOTE_TESTGIT_SIGNED_TAGS" && echo "signed-tags"
58 test -n "$GIT_REMOTE_TESTGIT_NO_PRIVATE_UPDATE" && echo "no-private-update"
64 echo ":object-format $(git rev-parse --show-object-format=storage)"
65 git for-each-ref
--format='? %(refname)' 'refs/heads/' 'refs/tags/'
66 head=$
(git symbolic-ref HEAD
)
71 # read all import lines
77 test "${line%% *}" != "import" && break
80 if test -n "$gitmarks"
82 echo "feature import-marks=$gitmarks"
83 echo "feature export-marks=$gitmarks"
86 if test -n "$GIT_REMOTE_TESTGIT_FAILURE"
94 ${h_refspec:+"--refspec=$h_refspec"} \
95 ${t_refspec:+"--refspec=$t_refspec"} \
96 ${testgitmarks:+"--import-marks=$testgitmarks"} \
97 ${testgitmarks:+"--export-marks=$testgitmarks"} \
102 if test -n "$GIT_REMOTE_TESTGIT_FAILURE"
104 # consume input so fast-export doesn't get SIGPIPE;
105 # git would also notice that case, but we want
106 # to make sure we are exercising the later
109 test "done" = "$line" && break
114 before
=$
(git for-each-ref
--format=' %(refname) %(objectname) ')
118 ${testgitmarks:+"--import-marks=$testgitmarks"} \
119 ${testgitmarks:+"--export-marks=$testgitmarks"} \
122 # figure out which refs were updated
123 git for-each-ref
--format='%(refname) %(objectname)' |
128 continue ;; # unchanged
130 if test -z "$GIT_REMOTE_TESTGIT_PUSH_ERROR"
134 echo "error $ref $GIT_REMOTE_TESTGIT_PUSH_ERROR"
141 read cmd opt val
<<-EOF
146 test $val = "true" && force
="true" || force
=
150 test $val = "true" && object_format
="true" || object_format
=