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"
23 if test -z "$GIT_REMOTE_TESTGIT_NO_MARKS"
25 gitmarks="$dir/git.marks"
26 testgitmarks="$dir/testgit.marks"
27 test -e "$gitmarks" || >"$gitmarks"
28 test -e "$testgitmarks" || >"$testgitmarks"
37 test -n "$refspec" && echo "refspec $refspec"
38 if test -n "$gitmarks"
40 echo "*import-marks $gitmarks"
41 echo "*export-marks $gitmarks"
43 test -n "$GIT_REMOTE_TESTGIT_SIGNED_TAGS" && echo "signed-tags"
44 test -n "$GIT_REMOTE_TESTGIT_NO_PRIVATE_UPDATE" && echo "no-private-update"
49 git for-each-ref --format='? %(refname)' 'refs/heads/'
50 head=$(git symbolic-ref HEAD)
55 # read all import lines
61 test "${line%% *}" != "import" && break
64 if test -n "$gitmarks"
66 echo "feature import-marks=$gitmarks"
67 echo "feature export-marks=$gitmarks"
70 if test -n "$GIT_REMOTE_TESTGIT_FAILURE"
78 ${testgitmarks:+"--import-marks=$testgitmarks"} \
79 ${testgitmarks:+"--export-marks=$testgitmarks"} \
81 sed -e "s#refs/heads/#${prefix}/heads/#g"
85 if test -n "$GIT_REMOTE_TESTGIT_FAILURE"
87 # consume input so fast-export doesn't get SIGPIPE;
88 # git would also notice that case, but we want
89 # to make sure we are exercising the later
92 test "done" = "$line" && break
97 before=$(git for-each-ref --format=' %(refname) %(objectname) ')
101 ${testgitmarks:+"--import-marks=$testgitmarks"} \
102 ${testgitmarks:+"--export-marks=$testgitmarks"} \
105 # figure out which refs were updated
106 git for-each-ref --format='%(refname) %(objectname)' |
111 continue ;; # unchanged
113 if test -z "$GIT_REMOTE_TESTGIT_PUSH_ERROR"
117 echo "error $ref $GIT_REMOTE_TESTGIT_PUSH_ERROR"
124 read cmd opt val <<-EOF
129 test $val = "true" && force="true" || force=