From 9adcf8635845ee98f94cb09d0aaa39749f3dccc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 4 Mar 2026 22:12:42 +0100 Subject: [PATCH] style: git-source: Gracefully handle failure to checkout version tag. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- 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