summaryrefslogtreecommitdiff
path: root/etc/git
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-05-29 18:19:07 +0200
committerLudovic Courtès <ludo@gnu.org>2020-05-29 18:31:38 +0200
commite65a44649e8d7698c4a888f1de625a67052520e9 (patch)
treefc36c4088a82f2af4d1d52c492d1ee5bf505b9fc /etc/git
parent17a102332a253f0e3b1f511fa7bda2094264a77c (diff)
maint: Git pre-push hook runs "make authenticate check-channel-news".
* etc/git/pre-push: Change to run "make authenticate check-channel-news".
Diffstat (limited to 'etc/git')
-rwxr-xr-xetc/git/pre-push49
1 files changed, 5 insertions, 44 deletions
diff --git a/etc/git/pre-push b/etc/git/pre-push
index 9206a2dfe53..59294f0ffbd 100755
--- a/etc/git/pre-push
+++ b/etc/git/pre-push
@@ -1,7 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2 2
3# This hook script prevents the user from pushing to Savannah if any of the new 3# A hook script that prevents the user from pushing unsigned commits.
4# commits' OpenPGP signatures cannot be verified.
5 4
6# Called by "git push" after it has checked the remote status, but before 5# Called by "git push" after it has checked the remote status, but before
7# anything has been pushed. If this script exits with a non-zero status nothing 6# anything has been pushed. If this script exits with a non-zero status nothing
@@ -19,51 +18,13 @@
19# 18#
20# <local ref> <local sha1> <remote ref> <remote sha1> 19# <local ref> <local sha1> <remote ref> <remote sha1>
21 20
22z40=0000000000000000000000000000000000000000
23
24# Only use the hook when pushing to Savannah. 21# Only use the hook when pushing to Savannah.
25case "$2" in 22case "$2" in
26*git.sv.gnu.org*) 23 *.gnu.org*)
27 break 24 exec make authenticate check-channel-news
25 exit 127
28 ;; 26 ;;
29*) 27 *)
30 exit 0 28 exit 0
31 ;; 29 ;;
32esac 30esac
33
34while read local_ref local_sha remote_ref remote_sha
35do
36 if [ "$local_sha" = $z40 ]
37 then
38 # Handle delete
39 :
40 else
41 if [ "$remote_sha" = $z40 ]
42 then
43 # We are pushing a new branch. To prevent wasting too
44 # much time for this relatively rare case, we examine
45 # all commits since the first signed commit, rather than
46 # the full history. This check *will* fail, and the user
47 # will need to temporarily disable the hook to push the
48 # new branch.
49 range="e3d0fcbf7e55e8cbe8d0a1c5a24d73f341d7243b..$local_sha"
50 else
51 # Update to existing branch, examine new commits
52 range="$remote_sha..$local_sha"
53 fi
54
55 # Verify the signatures of all commits being pushed.
56 ret=0
57 for commit in $(git rev-list $range)
58 do
59 if ! git verify-commit $commit >/dev/null 2>&1
60 then
61 printf "%s failed signature check\n" $commit
62 ret=1
63 fi
64 done
65 exit $ret
66 fi
67done
68
69exit 0