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"
21 if test -z "$GIT_REMOTE_TESTGIT_NO_MARKS"
23 gitmarks
="$dir/git.marks"
24 testgitmarks
="$dir/testgit.marks"
25 test -e "$gitmarks" ||
>"$gitmarks"
26 test -e "$testgitmarks" ||
>"$testgitmarks"
35 test -n "$refspec" && echo "refspec $refspec"
36 if test -n "$gitmarks"
38 echo "*import-marks $gitmarks"
39 echo "*export-marks $gitmarks"
41 test -n "$GIT_REMOTE_TESTGIT_SIGNED_TAGS" && echo "signed-tags"
42 test -n "$GIT_REMOTE_TESTGIT_NO_PRIVATE_UPDATE" && echo "no-private-update"
46 git for-each-ref
--format='? %(refname)' 'refs/heads/'
47 head=$
(git symbolic-ref HEAD
)
52 # read all import lines
58 test "${line%% *}" != "import" && break
61 if test -n "$gitmarks"
63 echo "feature import-marks=$gitmarks"
64 echo "feature export-marks=$gitmarks"
67 if test -n "$GIT_REMOTE_TESTGIT_FAILURE"
75 ${testgitmarks:+"--import-marks=$testgitmarks"} \
76 ${testgitmarks:+"--export-marks=$testgitmarks"} \
78 sed -e "s#refs/heads/#${prefix}/heads/#g"
82 if test -n "$GIT_REMOTE_TESTGIT_FAILURE"
84 # consume input so fast-export doesn't get SIGPIPE;
85 # git would also notice that case, but we want
86 # to make sure we are exercising the later
89 test "done" = "$line" && break
94 before
=$
(git for-each-ref
--format=' %(refname) %(objectname) ')
97 ${testgitmarks:+"--import-marks=$testgitmarks"} \
98 ${testgitmarks:+"--export-marks=$testgitmarks"} \
101 # figure out which refs were updated
102 git for-each-ref
--format='%(refname) %(objectname)' |
107 continue ;; # unchanged
109 if test -z "$GIT_REMOTE_TESTGIT_PUSH_ERROR"
113 echo "error $ref $GIT_REMOTE_TESTGIT_PUSH_ERROR"