Message ID | 86y24exbnk.fsf@gmail.com |
---|---|
State | New |
Headers | show |
Series | [bug#52691] git: Display a hint when CLONE* lacks permission. | expand |
Context | Check | Description |
---|---|---|
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | success | View Laminar job |
cbaines/issue | success | View issue |
Simon, zimoun 写道: > Instead of hint, I propose this patch which displays: Perfect! That's what I wanted to write, but couldn't :-) (I still don't really understand THROW and friends, or what exactly your snippet does, but the output is exactly what I had in mind.) Thanks! LGTM, obviously. > the ’match’ can be avoided True, but I chose it deliberately, and still prefer it over CAR or equivalent. Kind regards, T G-R
Hi, On Tue, 21 Dec 2021 at 16:03, Tobias Geerinckx-Rice <me@tobias.gr> wrote: > zimoun 写道: > > Instead of hint, I propose this patch which displays: > > Perfect! That's what I wanted to write, but couldn't :-) > > (I still don't really understand THROW and friends, or what > exactly your snippet does, but the output is exactly what I had in > mind.) Me neither! Especially with new and old way, And the examples in the manual do not help very well to understand, IMHO. Another story. :-) > Thanks! LGTM, obviously. Feel free to proceed. :-) > > the ’match’ can be avoided > > True, but I chose it deliberately, and still prefer it over CAR or > equivalent. Yes, me too. This 'car' was because I had been lazy. It was about this pattern: (lambda args (match args ((a b c) #t) (_ #f) when 'args' is an error. :-) Cheers, simon
diff --git a/guix/git.scm b/guix/git.scm index dc2ca1be84..e2285f5f55 100644 --- a/guix/git.scm +++ b/guix/git.scm @@ -200,8 +200,12 @@ (define (clone* url directory) (clone url directory (make-clone-options #:fetch-options (make-default-fetch-options)))) - (lambda _ - (false-if-exception (rmdir directory))))) + (lambda (key subr fmt args . rest) + (let ((message (match args + ((reason tail ...) + (list (string-append reason " " directory)))))) + (false-if-exception (rmdir directory)) + (apply throw key subr fmt message rest))))) (define (url+commit->name url sha1) "Return the string \"<REPO-NAME>-<SHA1:7>\" where REPO-NAME is the name of