Hello!

[email protected] (Ludovic Courtès) writes:

>>>> I like it, but it doesn't seem to actually print anything for me when I
>>>> trigger the failing case, for example by fetching the libssh source over
>>>> HTTP.
>>>
>>> If might be that current-output-port is fully buffered.  What if you
>>> add:
>>>
>>>   (setvbuf (current-output-port) 'line)
>>>
>>> before the ‘format’ call?
>>>
>>> Thanks,
>>> Ludo’, who is found guilty of not actually running the code.
>>
>> What is preferable, between your solution or using (force-output)?
>
> I’d go for line buffering since you only need to do it once for all.

I finally got around to reproducing the problem and testing the fix; it
was costly to build using --no-substitutes.

Is it OK to push this patch into master?

Thanks,

Maxim
>From 44782db3f63a29cdbd98cddb77eab8a473806765 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <[email protected]>
Date: Wed, 24 Oct 2018 08:49:50 -0400
Subject: [PATCH] git-download: Print a message when falling back to a full
 fetch.

Otherwise the user might believe that git-fetch stalled, observing the lack of
output following a 'fatal' git error message (see:
https://debbugs.gnu.org/33100).

* guix/build/git.scm (git-fetch): Print message when falling back to a full
fetch.
---
 guix/build/git.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/guix/build/git.scm b/guix/build/git.scm
index 14d415a6f..2d1700a9b 100644
--- a/guix/build/git.scm
+++ b/guix/build/git.scm
@@ -45,6 +45,8 @@ recursively.  Return #t on success, #f otherwise."
     (if (zero? (system* git-command "fetch" "--depth" "1" "origin" commit))
         (invoke git-command "checkout" "FETCH_HEAD")
         (begin
+          (setvbuf (current-output-port) 'line)
+          (format #t "Failed to do a shallow fetch; retrying a full fetch...~%")
           (invoke git-command "fetch" "origin")
           (invoke git-command "checkout" commit)))
     (when recursive?
-- 
2.19.0

Reply via email to