git authenticate: Discover the repository.

This allows one to run ‘guix git authenticate’ from a sub-directory of
the checkout.

* guix/scripts/git/authenticate.scm (%default-options): Remove
‘directory’ key.
(guix-git-authenticate): Use ‘repository-discover’ when ‘directory’
option is missing.

Change-Id: Ifada00d559254971ed7eeb8c0a8d4ae74ff3defc
This commit is contained in:
Ludovic Courtès 2024-03-13 13:08:38 +01:00
parent 7b4bf4ee88
commit 88573dd928
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -74,7 +74,7 @@ (define %options
(alist-cons 'show-stats? #t result)))))
(define %default-options
'((directory . ".")))
'())
(define (current-branch repository)
"Return the name of the checked out branch of REPOSITORY or #f if it could
@ -236,9 +236,9 @@ (define (missing-arguments)
(with-error-handling
(with-git-error-handling
(let* ((directory (assoc-ref options 'directory))
(show-stats? (assoc-ref options 'show-stats?))
(repository (repository-open directory))
(let* ((show-stats? (assoc-ref options 'show-stats?))
(repository (repository-open (or (assoc-ref options 'directory)
(repository-discover "."))))
(commit signer (match (command-line-arguments options)
((commit signer)
(values commit signer))