chiark / gitweb /
changelog: start 9.14
[dgit.git] / git-debpush
index 402b1dd6a14d5b13df45fb488f36520acbcf6319..2790560cf21658b5275bcd7d180db9909d696c59 100755 (executable)
@@ -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=()