Hi Ludovic,

l...@gnu.org (Ludovic Courtès) writes:

[...]

>> Perhaps just clearer messages would have helped here also ('Failed to do
>> a shallow git clone due to ~error message~, falling back to a full clone').
>
> I agree, and that’s something to suggest to the Git folks.  :-)

Upon further inspection, we can do better on our side, specifically by
printing a message of the fallback occurring when calling git-fetch. The
patch below implements this simple change.

What do you think?

>From 06ba66d1949ba59573518f471ad3cbacefea6ea2 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.courno...@gmail.com>
Date: Wed, 24 Oct 2018 08:49:50 -0400
Subject: [PATCH] build: git-fetch: Print message when falling back to a full
 checkout.

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
checkout.
---
 guix/build/git.scm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/guix/build/git.scm b/guix/build/git.scm
index 14d415a6f..df8f1548b 100644
--- a/guix/build/git.scm
+++ b/guix/build/git.scm
@@ -45,6 +45,7 @@ recursively.  Return #t on success, #f otherwise."
     (if (zero? (system* git-command "fetch" "--depth" "1" "origin" commit))
         (invoke git-command "checkout" "FETCH_HEAD")
         (begin
+          (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

Maxim

Reply via email to