* [bug#42868] [PATCH] maint: Only run `make authenticate` when pushing commits.
@ 2020-08-14 20:30 Leo Famulari
2020-08-19 22:29 ` Jakub Kądziołka
2020-08-30 19:47 ` Ludovic Courtès
0 siblings, 2 replies; 6+ messages in thread
From: Leo Famulari @ 2020-08-14 20:30 UTC (permalink / raw)
To: 42868
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(-)
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
--
2.28.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [bug#42868] [PATCH] maint: Only run `make authenticate` when pushing commits.
2020-08-14 20:30 [bug#42868] [PATCH] maint: Only run `make authenticate` when pushing commits Leo Famulari
@ 2020-08-19 22:29 ` Jakub Kądziołka
2020-08-30 19:47 ` Ludovic Courtès
1 sibling, 0 replies; 6+ messages in thread
From: Jakub Kądziołka @ 2020-08-19 22:29 UTC (permalink / raw)
To: Leo Famulari; +Cc: 42868
[-- Attachment #1: Type: text/plain, Size: 382 bytes --]
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* [bug#42868] [PATCH] maint: Only run `make authenticate` when pushing commits.
2020-08-14 20:30 [bug#42868] [PATCH] maint: Only run `make authenticate` when pushing commits Leo Famulari
2020-08-19 22:29 ` Jakub Kądziołka
@ 2020-08-30 19:47 ` Ludovic Courtès
2020-12-13 20:35 ` Leo Famulari
1 sibling, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2020-08-30 19:47 UTC (permalink / raw)
To: Leo Famulari; +Cc: 42868
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’.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [bug#42868] [PATCH] maint: Only run `make authenticate` when pushing commits.
2020-08-30 19:47 ` Ludovic Courtès
@ 2020-12-13 20:35 ` Leo Famulari
2020-12-14 8:28 ` Ludovic Courtès
0 siblings, 1 reply; 6+ messages in thread
From: Leo Famulari @ 2020-12-13 20:35 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 42868
[-- Attachment #1.1: Type: text/plain, Size: 523 bytes --]
On Sun, Aug 30, 2020 at 09:47:59PM +0200, Ludovic Courtès wrote:
> 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.
The previous version of this patch was untested and broken!
Here is a new one that is actually tested and working.
[-- Attachment #1.2: 0001-maint-Only-run-make-authenticate-when-pushing-commit.patch --]
[-- Type: text/plain, Size: 1387 bytes --]
From e8546a590a560825c3231af14724329c3d2bfee7 Mon Sep 17 00:00:00 2001
From: Leo Famulari <leo@famulari.name>
Date: Fri, 14 Aug 2020 16:30:47 -0400
Subject: [PATCH] maint: Only run `make authenticate` when pushing commits.
* etc/git/pre-push: Exit early when deleting a branch.
---
etc/git/pre-push | 33 +++++++++++++++++++++++----------
1 file 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
--
2.29.2
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [bug#42868] [PATCH] maint: Only run `make authenticate` when pushing commits.
2020-12-13 20:35 ` Leo Famulari
@ 2020-12-14 8:28 ` Ludovic Courtès
2020-12-14 17:17 ` bug#42868: " Leo Famulari
0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2020-12-14 8:28 UTC (permalink / raw)
To: Leo Famulari; +Cc: 42868
Hi,
Leo Famulari <leo@famulari.name> skribis:
> From e8546a590a560825c3231af14724329c3d2bfee7 Mon Sep 17 00:00:00 2001
> From: Leo Famulari <leo@famulari.name>
> Date: Fri, 14 Aug 2020 16:30:47 -0400
> Subject: [PATCH] maint: Only run `make authenticate` when pushing commits.
>
> * etc/git/pre-push: Exit early when deleting a branch.
LGTM, thanks!
Ludo’.
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#42868: [PATCH] maint: Only run `make authenticate` when pushing commits.
2020-12-14 8:28 ` Ludovic Courtès
@ 2020-12-14 17:17 ` Leo Famulari
0 siblings, 0 replies; 6+ messages in thread
From: Leo Famulari @ 2020-12-14 17:17 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 42868-done
On Mon, Dec 14, 2020 at 09:28:01AM +0100, Ludovic Courtès wrote:
> Hi,
>
> Leo Famulari <leo@famulari.name> skribis:
>
> > From e8546a590a560825c3231af14724329c3d2bfee7 Mon Sep 17 00:00:00 2001
> > From: Leo Famulari <leo@famulari.name>
> > Date: Fri, 14 Aug 2020 16:30:47 -0400
> > Subject: [PATCH] maint: Only run `make authenticate` when pushing commits.
> >
> > * etc/git/pre-push: Exit early when deleting a branch.
>
> LGTM, thanks!
Thanks! Pushed as 80ebcdd100a82fdc582e62f35042c74ce38ea753
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-12-14 17:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-14 20:30 [bug#42868] [PATCH] maint: Only run `make authenticate` when pushing commits Leo Famulari
2020-08-19 22:29 ` Jakub Kądziołka
2020-08-30 19:47 ` Ludovic Courtès
2020-12-13 20:35 ` Leo Famulari
2020-12-14 8:28 ` Ludovic Courtès
2020-12-14 17:17 ` bug#42868: " Leo Famulari
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).