diff mbox series

[bug#69780,v2,2/5] git authenticate: Discover the repository.

Message ID c759c73736ba0d80f105f5970ecf65bf6f7635b5.1712522119.git.ludo@gnu.org
State New
Headers show
Series [bug#69780,v2,1/5] git authenticate: Record introduction and keyring in ‘.git/config’. | expand

Commit Message

Ludovic Courtès April 7, 2024, 8:38 p.m. UTC
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
---
 guix/scripts/git/authenticate.scm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/guix/scripts/git/authenticate.scm b/guix/scripts/git/authenticate.scm
index a606f1c146..d81a0e1ffb 100644
--- a/guix/scripts/git/authenticate.scm
+++ b/guix/scripts/git/authenticate.scm
@@ -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 (guix-git-authenticate . args)
 
   (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))