guix_mirror_bot pushed a commit to branch master
in repository guix.

commit 9adcf8635845ee98f94cb09d0aaa39749f3dccc5
Author: Ludovic Courtès <[email protected]>
AuthorDate: Wed Mar 4 22:12:42 2026 +0100

    style: git-source: Gracefully handle failure to checkout version tag.
    
    Previously, when the version tag could not be cloned, ‘generate-git-source’
    would return #f leading ‘guix style’ to crash with a type error.  Now, a
    warning about the Git error is printed and ‘guix style’ keeps going.
    
    * guix/scripts/style.scm (transform-to-git-fetch): Wrap ‘match’ clause in
    ‘catch’ and return #f on ‘git-error’.
    
    Change-Id: If66b1c5f8e0a44155b96f3c54bab7c58aae406f8
    Signed-off-by: Ludovic Courtès <[email protected]>
---
 guix/scripts/style.scm | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/guix/scripts/style.scm b/guix/scripts/style.scm
index 049ce95b31..c38efac7ed 100644
--- a/guix/scripts/style.scm
+++ b/guix/scripts/style.scm
@@ -578,15 +578,22 @@ Return the new origin S-expression or #f if 
transformation isn't applicable."
        ('uri uri-expr)
        ('sha256 ('base32 _))
        rest ...)
-     (let ((rest (filter (match-lambda
-                           (('patches . _) #t)
-                           (('modules . _) #t)
-                           (('snippet . _) #t)
-                           (_ #f))
-                         rest)))
-       `(,@(generate-git-source repository-url version
-                                (default-git-error repository-url location))
-         ,@rest)))
+     (catch 'git-error
+       (lambda ()
+         (let ((rest (filter (match-lambda
+                               (('patches . _) #t)
+                               (('modules . _) #t)
+                               (('snippet . _) #t)
+                               (_ #f))
+                             rest)))
+           `(,@(generate-git-source repository-url version
+                                    (lambda args
+                                      (apply throw args)))
+             ,@rest)))
+       (let ((report-error (default-git-error repository-url location)))
+         (lambda args
+           (apply report-error args)
+           #f))))
     (_ #f)))
 
 (define* (url-fetch->git-fetch package

Reply via email to