2 # Copyright (c) 2012 Felipe Contreras
7 dir
="$GIT_DIR/testgit/$alias"
8 prefix
="refs/testgit/$alias"
10 default_refspec
="refs/heads/*:${prefix}/heads/*"
12 refspec
="${GIT_REMOTE_TESTGIT_REFSPEC-$default_refspec}"
14 test -z "$refspec" && prefix
="refs"
16 export GIT_DIR
="$url/.git"
22 if test -z "$GIT_REMOTE_TESTGIT_NO_MARKS"
24 gitmarks
="$dir/git.marks"
25 testgitmarks
="$dir/testgit.marks"
26 test -e "$gitmarks" ||
>"$gitmarks"
27 test -e "$testgitmarks" ||
>"$testgitmarks"
36 test -n "$refspec" && echo "refspec $refspec"
37 if test -n "$gitmarks"
39 echo "*import-marks $gitmarks"
40 echo "*export-marks $gitmarks"
42 test -n "$GIT_REMOTE_TESTGIT_SIGNED_TAGS" && echo "signed-tags"
43 test -n "$GIT_REMOTE_TESTGIT_NO_PRIVATE_UPDATE" && echo "no-private-update"
48 git for-each-ref
--format='? %(refname)' 'refs/heads/'
49 head=$
(git symbolic-ref HEAD
)
54 # read all import lines
60 test "${line%% *}" != "import" && break
63 if test -n "$gitmarks"
65 echo "feature import-marks=$gitmarks"
66 echo "feature export-marks=$gitmarks"
69 if test -n "$GIT_REMOTE_TESTGIT_FAILURE"
77 ${testgitmarks:+"--import-marks=$testgitmarks"} \
78 ${testgitmarks:+"--export-marks=$testgitmarks"} \
80 sed -e "s#refs/heads/#${prefix}/heads/#g"
84 if test -n "$GIT_REMOTE_TESTGIT_FAILURE"
86 # consume input so fast-export doesn't get SIGPIPE;
87 # git would also notice that case, but we want
88 # to make sure we are exercising the later
91 test "done" = "$line" && break
96 before
=$
(git for-each-ref
--format=' %(refname) %(objectname) ')
100 ${testgitmarks:+"--import-marks=$testgitmarks"} \
101 ${testgitmarks:+"--export-marks=$testgitmarks"} \
104 # figure out which refs were updated
105 git for-each-ref
--format='%(refname) %(objectname)' |
110 continue ;; # unchanged
112 if test -z "$GIT_REMOTE_TESTGIT_PUSH_ERROR"
116 echo "error $ref $GIT_REMOTE_TESTGIT_PUSH_ERROR"
123 read cmd opt val
<<-EOF
128 test $val = "true" && force
="true" || force
=