chiark / gitweb /
Test suite: Prepare for pipefail in t-git-get-ref
[dgit.git] / tests / lib
index 9948c31407433ed5ea49c525e40ef490a0599656..a0a84dda142143b49901a7549e6638a1331c0d62 100644 (file)
--- a/tests/lib
+++ b/tests/lib
@@ -241,7 +241,11 @@ t-clean-on-branch () {
 
 t-git-get-ref () {
        local ref=$1
-       git show-ref -d $1 | perl -ne '
+       case "$ref" in
+       refs/*) ;;
+       *) fail "t-git-get-ref bad $ref" ;;
+       esac
+       (git show-ref -d $1 || test $? = 1) | perl -ne '
                $x = $1 if m#^(\w+) \Q'$1'\E(?:\^\{\})?$#;
                END { print "$x\n" if length $x; }
        '
@@ -366,8 +370,9 @@ t-ref-dsc-dgit () {
 t-apply-diff () {
        local v1=$1
        local v2=$2
-       (cd $troot/pkg-srcs; debdiff ${p}_${v1}.dsc ${p}_${v2}.dsc) \
-               | patch -p1 -u
+       (cd $troot/pkg-srcs;
+        debdiff ${p}_${v1}.dsc ${p}_${v2}.dsc || test $? = 1) \
+        | patch -p1 -u
 }
 
 t-commit () {