1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

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>
This commit is contained in:
Ludovic Courtès
2026-03-04 22:12:42 +01:00
parent 78ddf62bfe
commit 9adcf86358

View File

@@ -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