guix_mirror_bot pushed a commit to branch wip-hook in repository guix. commit 5bac84e248a462ae5d44b4a1c44e9a186394e5d2 Author: Leo Famulari <l...@famulari.name> AuthorDate: Wed May 28 12:31:23 2025 -0400
etc: pre-push Git hook: Reduce code duplication. * etc/git/pre-push (guix_git_authenticate): New function. Change-Id: Ieff1e2c225e3720c96c75ca55abfb883dd386f5c --- etc/git/pre-push | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/etc/git/pre-push b/etc/git/pre-push index 19c344d91e..51c400e42e 100755 --- a/etc/git/pre-push +++ b/etc/git/pre-push @@ -23,6 +23,14 @@ # This is the "empty hash" used by Git when pushing a branch deletion. z40=0000000000000000000000000000000000000000 +guix_git_authenticate() { + set -e + guix git authenticate + exec make check-channel-news + exit 127 +} + +main() { while read local_ref local_hash remote_ref remote_hash do # When deleting a remote branch, no commits are pushed to the remote, and @@ -39,16 +47,10 @@ do # Only use the hook when pushing to upstream. case "$2" in *.gnu.org*) - set -e - guix git authenticate - exec make check-channel-news - exit 127 + guix_git_authenticate ;; *codeberg.org/guix/*) - set -e - guix git authenticate - exec make check-channel-news - exit 127 + guix_git_authenticate ;; *) exit 0 @@ -58,3 +60,6 @@ do done exit 0 +} + +main "$@"