chiark / gitweb /
Dgit.pm: reflog_cache_insert: Use ensurepath for the reflog
[dgit.git] / git-debpush
index 5ffbd52c9e4b54012be49445ea75742e4df013bb..63057ed24ee3334c3cfc4dd0d5d35bcc3cdec1ef 100755 (executable)
@@ -95,7 +95,8 @@ while true; do
         '--baredebian'|'--baredebian+git')
             quilt_mode=baredebian;         shift; continue ;;
         '--baredebian+tarball')
-            quilt_mode=baredebian+tarball; shift; continue ;;
+            fail "--baredebian+tarball quilt mode not supported"
+            ;;
 
         '--') shift; break ;;
        *) badusage "unknown option $1" ;;
@@ -107,8 +108,9 @@ if [ $# != 0 ]; then
 fi
 
 case "$quilt_mode" in
-    linear|auto|smash|nofix|gbp|dpm|unapplied|baredebian|baredebian+tarball|'') ;;
+    linear|auto|smash|nofix|gbp|dpm|unapplied|baredebian|'') ;;
     baredebian+git) quilt_mode="baredebian" ;;
+    baredebian+tarball) fail "--baredebian+tarball quilt mode not supported" ;;
     *) badusage "invalid quilt mode: $quilt_mode" ;;
 esac
 
@@ -216,8 +218,23 @@ esac
 upstream_info=""
 if $upstream; then
     if [ "x$upstream_tag" = x ]; then
-       upstream_tag=$(git deborig --just-print --version="$version" \
-                          | head -n1)
+       upstream_tag=$(
+           set +e
+           git deborig --just-print --version="$version" \
+                          | head -n1
+           ps="${PIPESTATUS[*]}"
+           set -e
+           case "$ps" in
+               "0 0"|"141 0") ;; # ok or SIGPIPE
+               *" 0")
+                   echo >&2 \
+ "$us: git-deborig failed; maybe try $us --upstream=TAG"
+                   exit 0
+                   ;;
+               *) exit 127; # presumably head will have complained
+           esac
+       )
+       if [ "x$upstream_tag" = x ]; then exit 127; fi
     fi
     upstream_committish=$(git rev-parse "refs/tags/${upstream_tag}"^{})
     upstream_info=" upstream-tag=$upstream_tag upstream=$upstream_committish"