X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=tests%2Ftests%2Fdrs-push-rejects;h=e80620daafe11233289f6a81727688d193ae6923;hb=d45a224aee98c04bf3038dcda9b258ba5abf0d70;hp=5f6d04a498792e43ef1c318693f31498ae9dfde7;hpb=683b0eb026fa6b43cc0a9ae122764f9a5d031f59;p=dgit.git diff --git a/tests/tests/drs-push-rejects b/tests/tests/drs-push-rejects index 5f6d04a4..e80620da 100755 --- a/tests/tests/drs-push-rejects +++ b/tests/tests/drs-push-rejects @@ -10,37 +10,16 @@ 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[*]}" - set -e - case $ps in - "0 0") fail "push unexpectedly succeeded (instead of: $wantmsg)" ;; - *" 0") ;; - *) fail "tee failed" ;; - esac - 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 + local mpat="$1"; shift + t-expect-push-fail "$mpat" \ + git push origin "$@" } mustsucceed () { - reporefs >$tmp/show-refs.pre-push + t-reporefs pre-push git push origin "$@" - reporefs >$tmp/show-refs.post-push + t-reporefs post-push if diff $tmp/show-refs.{pre,post}-push >$tmp/show-refs.diff; then fail "no refs updated" fi