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"
40 test -n "$GIT_REMOTE_TESTGIT_SIGNED_TAGS" && echo "signed-tags"
41 test -n "$GIT_REMOTE_TESTGIT_NO_PRIVATE_UPDATE" && echo "no-private-update"
45 git for-each-ref
--format='? %(refname)' 'refs/heads/'
46 head=$
(git symbolic-ref HEAD
)
51 # read all import lines
57 test "${line%% *}" != "import" && break
60 if test -n "$gitmarks"
62 echo "feature import-marks=$gitmarks"
63 echo "feature export-marks=$gitmarks"
66 if test -n "$GIT_REMOTE_TESTGIT_FAILURE"
74 ${testgitmarks:+"--import-marks=$testgitmarks"} \
75 ${testgitmarks:+"--export-marks=$testgitmarks"} \
77 sed -e "s#refs/heads/#${prefix}/heads/#g"
81 if test -n "$GIT_REMOTE_TESTGIT_FAILURE"
83 # consume input so fast-export doesn't get SIGPIPE;
84 # git would also notice that case, but we want
85 # to make sure we are exercising the later
88 test "done" = "$line" && break
93 before
=$
(git for-each-ref
--format=' %(refname) %(objectname) ')
96 ${testgitmarks:+"--import-marks=$testgitmarks"} \
97 ${testgitmarks:+"--export-marks=$testgitmarks"} \
100 # figure out which refs were updated
101 git for-each-ref
--format='%(refname) %(objectname)' |
106 continue ;; # unchanged
108 if test -z "$GIT_REMOTE_TESTGIT_PUSH_ERROR"
112 echo "error $ref $GIT_REMOTE_TESTGIT_PUSH_ERROR"