aboutsummaryrefslogtreecommitdiff
path: root/etc/git
diff options
context:
space:
mode:
authorLeo Famulari <leo@famulari.name>2020-08-14 16:30:47 -0400
committerLeo Famulari <leo@famulari.name>2020-12-14 12:15:06 -0500
commit80ebcdd100a82fdc582e62f35042c74ce38ea753 (patch)
treeac6a33796ee1e89761e8d2c612baa3324edf8ddd /etc/git
parent3ef808bbeb6109fb4889ac29e6d3be5df81e61a3 (diff)
downloadguix-80ebcdd100a82fdc582e62f35042c74ce38ea753.tar
guix-80ebcdd100a82fdc582e62f35042c74ce38ea753.tar.gz
maint: Only run `make authenticate` when pushing commits.
* etc/git/pre-push: Exit early when deleting a branch.
Diffstat (limited to 'etc/git')
-rwxr-xr-xetc/git/pre-push33
1 files changed, 23 insertions, 10 deletions
diff --git a/etc/git/pre-push b/etc/git/pre-push
index 415345fc75..59671b0d58 100755
--- a/etc/git/pre-push
+++ b/etc/git/pre-push
@@ -20,13 +20,26 @@
#
# <local ref> <local sha1> <remote ref> <remote sha1>
-# Only use the hook when pushing to Savannah.
-case "$2" in
- *.gnu.org*)
- exec make authenticate check-channel-news
- exit 127
- ;;
- *)
- exit 0
- ;;
-esac
+# This is the "empty hash" used by Git when pushing a branch deletion.
+z40=0000000000000000000000000000000000000000
+
+while read local_ref local_hash remote_ref remote_hash
+do
+ # When deleting a remote branch, no commits are pushed to the remote, and
+ # thus there are no signatures to be verified.
+ if [ "$local_hash" != $z40 ]
+ then
+ # Only use the hook when pushing to Savannah.
+ case "$2" in
+ *.gnu.org*)
+ exec make authenticate check-channel-news
+ exit 127
+ ;;
+ *)
+ exit 0
+ ;;
+ esac
+ fi
+done
+
+exit 0