]>
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"
37 if test -z "$GIT_REMOTE_TESTGIT_NO_MARKS"
39 gitmarks
="$dir/git.marks"
40 testgitmarks
="$dir/testgit.marks"
41 test -e "$gitmarks" ||
>"$gitmarks"
42 test -e "$testgitmarks" ||
>"$testgitmarks"
51 test -n "$h_refspec" && echo "refspec $h_refspec"
52 test -n "$t_refspec" && echo "refspec $t_refspec"
53 if test -n "$gitmarks"
55 echo "*import-marks $gitmarks"
56 echo "*export-marks $gitmarks"
58 test -n "$GIT_REMOTE_TESTGIT_SIGNED_TAGS" && echo "signed-tags"
59 test -n "$GIT_REMOTE_TESTGIT_NO_PRIVATE_UPDATE" && echo "no-private-update"
65 test -n "$object_format" &&
66 echo ":object-format $(git rev-parse --show-object-format=storage)"
67 git for-each-ref
--format='? %(refname)' 'refs/heads/' 'refs/tags/'
68 head=$
(git symbolic-ref HEAD
)
73 # read all import lines
79 test "${line%% *}" != "import" && break
82 if test -n "$gitmarks"
84 echo "feature import-marks=$gitmarks"
85 echo "feature export-marks=$gitmarks"
88 if test -n "$GIT_REMOTE_TESTGIT_FAILURE"
96 ${h_refspec:+"--refspec=$h_refspec"} \
97 ${t_refspec:+"--refspec=$t_refspec"} \
98 ${testgitmarks:+"--import-marks=$testgitmarks"} \
99 ${testgitmarks:+"--export-marks=$testgitmarks"} \
104 if test -n "$GIT_REMOTE_TESTGIT_FAILURE"
106 # consume input so fast-export doesn't get SIGPIPE;
107 # git would also notice that case, but we want
108 # to make sure we are exercising the later
111 test "done" = "$line" && break
116 before
=$
(git for-each-ref
--format=' %(refname) %(objectname) ')
120 ${testgitmarks:+"--import-marks=$testgitmarks"} \
121 ${testgitmarks:+"--export-marks=$testgitmarks"} \
124 # figure out which refs were updated
125 git for-each-ref
--format='%(refname) %(objectname)' |
130 continue ;; # unchanged
132 if test -z "$GIT_REMOTE_TESTGIT_PUSH_ERROR"
136 echo "error $ref $GIT_REMOTE_TESTGIT_PUSH_ERROR"
143 read cmd opt val
<<-EOF
148 test $val = "true" && force
="true" || force
=
152 test $val = "true" && object_format
="true" || object_format
=