summaryrefslogtreecommitdiff
path: root/git-debpush
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2019-07-22 16:17:34 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2019-07-22 17:08:51 +0100
commit1db770da2b41b1ed02061f5145a2d8abc6e9c22c (patch)
treeb30bb6b8cd376454e8b90cad520ef7823f49fc9a /git-debpush
parentd859eec10fe463619069a01f4489b2a11af31fab (diff)
git-debpush: Check for a detached head when pushing HEAD
See discussion in #932612. Suggested-by: Ian Jackson <ijackson@chiark.greenend.org.uk> Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'git-debpush')
-rwxr-xr-xgit-debpush8
1 files changed, 8 insertions, 0 deletions
diff --git a/git-debpush b/git-debpush
index 402b1dd..c3b067d 100755
--- a/git-debpush
+++ b/git-debpush
@@ -230,6 +230,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=()