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"
20 if test -z "$GIT_REMOTE_TESTGIT_NO_MARKS"
22 gitmarks
="$dir/git.marks"
23 testgitmarks
="$dir/testgit.marks"
24 test -e "$gitmarks" ||
>"$gitmarks"
25 test -e "$testgitmarks" ||
>"$testgitmarks"
34 test -n "$refspec" && echo "refspec $refspec"
35 if test -n "$gitmarks"
37 echo "*import-marks $gitmarks"
38 echo "*export-marks $gitmarks"
43 git for-each-ref
--format='? %(refname)' 'refs/heads/'
44 head=$
(git symbolic-ref HEAD
)
49 # read all import lines
55 test "${line%% *}" != "import" && break
58 if test -n "$gitmarks"
60 echo "feature import-marks=$gitmarks"
61 echo "feature export-marks=$gitmarks"
64 if test -n "$GIT_REMOTE_TESTGIT_FAILURE"
72 ${testgitmarks:+"--import-marks=$testgitmarks"} \
73 ${testgitmarks:+"--export-marks=$testgitmarks"} \
75 sed -e "s#refs/heads/#${prefix}/heads/#g"
79 if test -n "$GIT_REMOTE_TESTGIT_FAILURE"
81 # consume input so fast-export doesn't get SIGPIPE;
82 # git would also notice that case, but we want
83 # to make sure we are exercising the later
86 test "done" = "$line" && break
91 before
=$
(git for-each-ref
--format=' %(refname) %(objectname) ')
94 ${testgitmarks:+"--import-marks=$testgitmarks"} \
95 ${testgitmarks:+"--export-marks=$testgitmarks"} \
98 # figure out which refs were updated
99 git for-each-ref
--format='%(refname) %(objectname)' |
104 continue ;; # unchanged