}
t-reporefs () {
+ local whichoutput=$1; shift
+ local outputfile="$tmp/show-refs.$whichoutput"
(set -e
- if test -d $tmp/git/$p.git; then
+ exec >"$outputfile"
+ if test -d $tmp/git/$p.git; then
cd $tmp/git/$p.git
git show-ref |sort
fi)
mustfail () {
local wantmsg="$1"; shift
- t-reporefs >$tmp/show-refs.pre-push
+ t-reporefs pre-push
set +o pipefail
git push origin "$@" 2>&1 |tee $tmp/mustfail.txt
ps="${PIPESTATUS[*]}"
if ! fgrep "$wantmsg" $tmp/mustfail.txt >/dev/null; then
fail "error message not found"
fi
- t-reporefs >$tmp/show-refs.post-push
+ t-reporefs post-push
diff $tmp/show-refs.{pre,post}-push
}
mustsucceed () {
- t-reporefs >$tmp/show-refs.pre-push
+ t-reporefs pre-push
git push origin "$@"
- t-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