diff mbox series

[bug#42868] maint: Only run `make authenticate` when pushing commits.

Message ID 12ad49f9266b146b81f7c7347ec4d62d18602039.1597437024.git.leo@famulari.name
State Accepted
Headers show
Series [bug#42868] maint: Only run `make authenticate` when pushing commits. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job

Commit Message

Leo Famulari Aug. 14, 2020, 8:30 p.m. UTC
When deleting a remote branch, no commits are pushed to the remote, and
thus there are no signatures to be verified.

* etc/git/pre-push: Exit early when deleting a branch.
---
 etc/git/pre-push | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

Comments

Maja Kądziołka Aug. 19, 2020, 10:29 p.m. UTC | #1
On Fri, Aug 14, 2020 at 04:30:47PM -0400, Leo Famulari wrote:
> +z40=0000000000000000000000000000000000000000
> +
> +# If deleting a branch, there are no commits to check.
> +if [ "$local_sha" = $z40 ]
> +then
> +	true
> +else

Is there a reason this `if' is written like that? I would use != and get
rid of the do-nothing branch entirely.

Regards,
Jakub Kądziołka
Ludovic Courtès Aug. 30, 2020, 7:47 p.m. UTC | #2
Hi,

Leo Famulari <leo@famulari.name> skribis:

> When deleting a remote branch, no commits are pushed to the remote, and
> thus there are no signatures to be verified.
>
> * etc/git/pre-push: Exit early when deleting a branch.

I agree with Jakub regarding the ‘if’ :-), but other than that it LGTM.

Thanks!

Ludo’.
diff mbox series

Patch

diff --git a/etc/git/pre-push b/etc/git/pre-push
index 415345fc75..689673dcc9 100755
--- a/etc/git/pre-push
+++ b/etc/git/pre-push
@@ -20,13 +20,21 @@ 
 #
 #   <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
+z40=0000000000000000000000000000000000000000
+
+# If deleting a branch, there are no commits to check.
+if [ "$local_sha" = $z40 ]
+then
+	true
+else
+	# 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