X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=git-debpush;h=63057ed24ee3334c3cfc4dd0d5d35bcc3cdec1ef;hb=bbf8c0e0e9199c999108f5c367fd76336af1d6af;hp=e9b64d4a7fb31a0f3eea4daffdb34c26f83ee214;hpb=66f76f761bc38ab61dd068af4b9200b05002305b;p=dgit.git diff --git a/git-debpush b/git-debpush index e9b64d4a..63057ed2 100755 --- a/git-debpush +++ b/git-debpush @@ -66,7 +66,7 @@ get_file_from_ref () { # ---- Parse command line getopt=$(getopt -s bash -o 'nfu:' \ - -l 'no-push,force,branch:,remote:,distro:,quilt:,gbp,dpm,\ + -l 'no-push,force,branch:,remote:,distro:,upstream:,quilt:,gbp,dpm,\ baredebian,baredebian+git,baredebian+tarball' \ -n "$us" -- "$@") eval "set - $getopt" @@ -90,11 +90,13 @@ while true; do '--remote') remote=$2; shift 2; continue ;; '--distro') distro=$2; shift 2; continue ;; '--quilt') quilt_mode=$2; shift 2; continue ;; + '--upstream') upstream_tag=$2; shift 2; continue ;; '--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" ;; @@ -106,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 @@ -214,9 +217,25 @@ esac upstream_info="" if $upstream; then - # xxx want way to override this - upstream_tag=$(git deborig --just-print --version="$version" \ - | head -n1) + if [ "x$upstream_tag" = x ]; then + 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" fi