chiark / gitweb /
Test suite: Test that taints get auto removed
[dgit.git] / tests / lib
index f45dd0b2bb80ecbdec39807d471cac72bf2f531d..5b93d98dc86b074d71080106cf9ca35a8ec43e9c 100644 (file)
--- a/tests/lib
+++ b/tests/lib
@@ -74,10 +74,30 @@ t-expect-fail () {
 
 t-expect-push-fail () {
        local mpat="$1"; shift
+
+       local triedpush=`git rev-parse HEAD`
+
        t-reporefs pre-push
        t-expect-fail "$mpat"  "$@"
        t-reporefs post-push
        diff $tmp/show-refs.{pre,post}-push
+
+       t-git-objects-not-present '' $triedpush
+
+       eval "$t_expect_push_fail_hook"
+}
+
+t-git-objects-not-present () {
+       # t-git-objects-not-present GITDIR|'' OBJID [...]
+       # specifying '' means the repo for package $p
+       local gitdir="${1-$tmp/git/$p.git}"
+       local obj
+       if ! [ -e "$gitdir" ]; then return; fi
+       for obj in "$@"; do
+               GIT_DIR=$gitdir \
+               t-expect-fail 'unable to find' \
+               git cat-file -t $obj
+       done
 }
 
 t-reporefs () {