diff options
author | Ludovic Courtès <ludo@gnu.org> | 2025-06-08 20:02:42 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2025-06-22 23:45:36 +0200 |
commit | 99f85246e199bb9c98a3a0deebe3a257c7ce5ae1 (patch) | |
tree | d87e3b9ba9c02acb5c6531f5ed95f5e94d07862b | |
parent | 0ec5cab132599cf644f0697c5f189366c1ebc773 (diff) |
git authenticate: Do nothing when invoked from the keyring branch.
Fixes <https://issues.guix.gnu.org/78283>.
* guix/scripts/git/authenticate.scm (guix-git-authenticate): Call
‘current-branch’ and do nothing if it returns the keyring branch.
Reported-by: Vagrant Cascadian <vagrant@debian.org>
Change-Id: I66c2a3f4babf68ac1df0913db6bc708ac0c7968e
-rw-r--r-- | guix/scripts/git/authenticate.scm | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/guix/scripts/git/authenticate.scm b/guix/scripts/git/authenticate.scm index 5f05428461..c80fde42b4 100644 --- a/guix/scripts/git/authenticate.scm +++ b/guix/scripts/git/authenticate.scm @@ -351,26 +351,35 @@ expected COMMIT and SIGNER~%"))) (file (call-with-input-file file read-authorizations)))) (cache-key (or (assoc-ref options 'cache-key) - (repository-cache-key repository)))) - (define stats - (authenticate-repository repository (string->oid commit) - (openpgp-fingerprint* signer) - #:end end - #:keyring-reference keyring - #:historical-authorizations history - #:cache-key cache-key - #:make-reporter make-reporter)) + (repository-cache-key repository))) + (branch (current-branch repository))) + ;; Since the keyring branch is not authenticated, exit successfully + ;; when invoked on it. This exit status is what the 'post-merge' hook + ;; expects when running 'git pull' on that branch, and what the + ;; 'pre-push' hook expects when running 'git push' on that branch. + (if (and branch (string=? branch keyring)) + (info (G_ "current branch '~a' is the keyring branch; \ +doing nothing~%") + branch) + (let ((stats + (authenticate-repository repository (string->oid commit) + (openpgp-fingerprint* signer) + #:end end + #:keyring-reference keyring + #:historical-authorizations history + #:cache-key cache-key + #:make-reporter make-reporter))) - (if (configured? repository) - (maybe-upgrade-hooks repository) - (begin - (record-configuration repository - #:commit commit #:signer signer - #:keyring-reference keyring) - (install-hooks repository))) + (if (configured? repository) + (maybe-upgrade-hooks repository) + (begin + (record-configuration repository + #:commit commit #:signer signer + #:keyring-reference keyring) + (install-hooks repository))) - (when (and show-stats? (not (null? stats))) - (show-stats stats)) + (when (and show-stats? (not (null? stats))) + (show-stats stats)) - (info (G_ "successfully authenticated commit ~a~%") - (oid->string end)))))) + (info (G_ "successfully authenticated commit ~a~%") + (oid->string end)))))))) |