diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2026-03-04 22:12:42 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2026-03-10 22:53:54 +0100 |
| commit | 9adcf8635845ee98f94cb09d0aaa39749f3dccc5 (patch) | |
| tree | f37f92f3810ec79d4167a3c5a97b7dca263580d9 | |
| parent | 78ddf62bfe2264c0085fdce4b2cbcad07f6eaf16 (diff) | |
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 <ludo@gnu.org>
| -rw-r--r-- | guix/scripts/style.scm | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/guix/scripts/style.scm b/guix/scripts/style.scm index 049ce95b317..c38efac7ed2 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 |
