X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=git-debpush;h=2790560cf21658b5275bcd7d180db9909d696c59;hb=193cfa37a544a2c44f9252b83da54ca1af01c01f;hp=841937510b6f1666cafb52dc43cc490cd102d001;hpb=4bbb0ea95dcf9be8e26f19424ad3b5269a556783;p=dgit.git diff --git a/git-debpush b/git-debpush index 84193751..2790560c 100755 --- a/git-debpush +++ b/git-debpush @@ -59,8 +59,10 @@ badusage () { get_file_from_ref () { local path=$1 + # redirect to /dev/null instead of using `grep -Eq` to avoid grep + # SIGPIPEing git-ls-tree if git ls-tree --name-only -r "$branch" \ - | grep -Eq "^$path$"; then + | grep -E "^$path$" >/dev/null; then git cat-file blob $branch:$path fi } @@ -230,6 +232,14 @@ case "$quilt_mode" in *) badusage "invalid quilt mode: $quilt_mode" ;; esac +# **** Early sanity check **** + +if [ "$branch" = "HEAD" ] \ + && ! git symbolic-ref --quiet HEAD >/dev/null; then + fail_check detached \ + "HEAD is detached; you probably don't want to debpush it" +fi + # **** Gather git information **** remoteconfigs=() @@ -411,6 +421,20 @@ case "$quilt_mode" in ;; esac +# ---- git-debrebase branch format checks + +# only check branches, since you can't run `git debrebase conclude` on +# non-branches +case "$branch" in + refs/heads/*) + # see "STITCHING, PSEUDO-MERGES, FFQ RECORD" in git-debrebase(5) + ffq_prev_ref="refs/ffq-prev/${branch#refs/}" + if git show-ref --quiet --verify "$ffq_prev_ref"; then + fail_check unstitched \ + "this looks like an unstitched git-debrebase branch, which should not be pushed" + fi +esac + # ---- Summary if $failed_check; then