chiark / gitweb /
tests: drs-push-rejects: check that failures do not update any refs
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 5 Mar 2014 18:28:19 +0000 (18:28 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 5 Mar 2014 18:29:08 +0000 (18:29 +0000)
tests/tests/drs-push-rejects

index 9b2a08b..f6b5880 100755 (executable)
@@ -10,8 +10,17 @@ t-worktree drs
 
 cd $p
 
+reporefs () {
+       (set -e
+       if test -d $tmp/git/$p.git; then
+               cd $tmp/git/$p.git
+               git show-ref
+       fi)
+}
+
 mustfail () {
        local wantmsg="$1"; shift
+       reporefs >$tmp/show-refs.pre-push
        set +e
        git push origin "$@" 2>&1 |tee $tmp/mustfail.txt
        ps="${PIPESTATUS[*]}"
@@ -24,6 +33,8 @@ mustfail () {
        if ! fgrep "$wantmsg" $tmp/mustfail.txt >/dev/null; then
                fail "error message not found"
        fi
+       reporefs >$tmp/show-refs.post-push
+       diff $tmp/show-refs.{pre,post}-push
 }
 
 prep () {