]>
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 h_refspec
="refs/heads/*:refs/testgit/$alias/heads/*"
16 t_refspec
="refs/tags/*:refs/testgit/$alias/tags/*"
18 if test -n "$GIT_REMOTE_TESTGIT_NOREFSPEC"
31 if test -z "$GIT_REMOTE_TESTGIT_NO_MARKS"
33 gitmarks
="$dir/git.marks"
34 testgitmarks
="$dir/testgit.marks"
35 test -e "$gitmarks" ||
>"$gitmarks"
36 test -e "$testgitmarks" ||
>"$testgitmarks"
45 test -n "$h_refspec" && echo "refspec $h_refspec"
46 test -n "$t_refspec" && echo "refspec $t_refspec"
47 if test -n "$gitmarks"
49 echo "*import-marks $gitmarks"
50 echo "*export-marks $gitmarks"
52 test -n "$GIT_REMOTE_TESTGIT_SIGNED_TAGS" && echo "signed-tags"
53 test -n "$GIT_REMOTE_TESTGIT_NO_PRIVATE_UPDATE" && echo "no-private-update"
58 git for-each-ref
--format='? %(refname)' 'refs/heads/' 'refs/tags/'
59 head=$
(git symbolic-ref HEAD
)
64 # read all import lines
70 test "${line%% *}" != "import" && break
73 if test -n "$gitmarks"
75 echo "feature import-marks=$gitmarks"
76 echo "feature export-marks=$gitmarks"
79 if test -n "$GIT_REMOTE_TESTGIT_FAILURE"
87 ${h_refspec:+"--refspec=$h_refspec"} \
88 ${t_refspec:+"--refspec=$t_refspec"} \
89 ${testgitmarks:+"--import-marks=$testgitmarks"} \
90 ${testgitmarks:+"--export-marks=$testgitmarks"} \
95 if test -n "$GIT_REMOTE_TESTGIT_FAILURE"
97 # consume input so fast-export doesn't get SIGPIPE;
98 # git would also notice that case, but we want
99 # to make sure we are exercising the later
102 test "done" = "$line" && break
107 before
=$
(git for-each-ref
--format=' %(refname) %(objectname) ')
111 ${testgitmarks:+"--import-marks=$testgitmarks"} \
112 ${testgitmarks:+"--export-marks=$testgitmarks"} \
115 # figure out which refs were updated
116 git for-each-ref
--format='%(refname) %(objectname)' |
121 continue ;; # unchanged
123 if test -z "$GIT_REMOTE_TESTGIT_PUSH_ERROR"
127 echo "error $ref $GIT_REMOTE_TESTGIT_PUSH_ERROR"
134 read cmd opt val
<<-EOF
139 test $val = "true" && force
="true" || force
=