GNU bug report logs - #61910
[PATCH] git-download: Download a bare Git repository from SWH.

Previous Next

Package: guix-patches;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Thu, 2 Mar 2023 09:13:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#61910: closed ([PATCH] git-download: Download a bare Git
 repository from SWH.)
Date: Fri, 03 Mar 2023 13:28:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Fri, 03 Mar 2023 14:27:14 +0100
with message-id <87wn3yvubx.fsf_-_ <at> gnu.org>
and subject line Re: bug#61910: [PATCH] git-download: Download a bare Git repository from SWH.
has caused the debbugs.gnu.org bug report #61910,
regarding [PATCH] git-download: Download a bare Git repository from SWH.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
61910: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=61910
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Ludovic Courtès <ludo <at> gnu.org>
To: guix-patches <at> gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>
Subject: [PATCH] git-download: Download a bare Git repository from SWH.
Date: Thu,  2 Mar 2023 10:12:33 +0100
Fixes a bug whereby CR/LF convention would not be applied on Git
repositories retrieved from SWH:

  https://sympa.inria.fr/sympa/arc/swh-devel/2023-03/msg00000.html

Reported by Simon Tournier <simon.tournier <at> inserm.fr>.
Suggested by Valentin Lorentz <valentin.lorentz <at> inria.fr>.

* guix/git-download.scm (git-fetch)[build]: Pass #:archive-type to
'swh-download' and invoke "git clone" on the result.
---
 guix/git-download.scm | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

Hi there!

I just saw the discussion between Simon and Valentin (Cc’d) and
realized this could easily be fixed on our side because (guix swh)
is already equipped to fetch bare Git repositories.

To test it, comment out the ‘git-fetch’ and ‘download-nar’ calls in
(guix git-download) and run, say:

  ./pre-inst-env guix build -S guile-bash --check

I don’t know of a repository that has this CRLF problem though, so
we should check that it actually works as advertised on such a repo.

Thanks,
Ludo’.

diff --git a/guix/git-download.scm b/guix/git-download.scm
index a1566bed4d..9f57b4170d 100644
--- a/guix/git-download.scm
+++ b/guix/git-download.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2014-2021, 2023 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2017 Mathieu Lirzin <mthl <at> gnu.org>
 ;;; Copyright © 2017 Christopher Baines <mail <at> cbaines.net>
 ;;; Copyright © 2020 Jakub Kądziołka <kuba <at> kadziolka.net>
@@ -162,8 +162,17 @@ (define recursive?
                      (parameterize ((%verify-swh-certificate? #f))
                        (format (current-error-port)
                                "Trying to download from Software Heritage...~%")
+
+                       ;; Fetch the source as a bare Git repository (rather
+                       ;; than 'flat') so Git can post-process it in the usual
+                       ;; way, for instance to perform CR/LF conversion.
                        (swh-download (getenv "git url") (getenv "git commit")
-                                     #$output))))))))
+                                     "git-repo"
+                                     #:archive-type 'git-bare)
+                       (invoke #+(file-append git "/bin/git")
+                               "clone" "git-repo" #$output)
+                       (delete-file-recursively
+                        (string-append #$output "/.git")))))))))
 
   (mlet %store-monad ((guile (package->derivation guile system)))
     (gexp->derivation (or name "git-checkout") build

base-commit: ff5fbcc19bce6e94ead0cc79b27ae8ed0307463d
-- 
2.39.1



[Message part 3 (message/rfc822, inline)]
From: Ludovic Courtès <ludo <at> gnu.org>
To: Simon Tournier <zimon.toutoune <at> gmail.com>
Cc: 61910-done <at> debbugs.gnu.org
Subject: Re: bug#61910: [PATCH] git-download: Download a bare Git repository
 from SWH.
Date: Fri, 03 Mar 2023 14:27:14 +0100
Hi again,

I pushed a slightly modified version of your patch as commit
58f20fa8181bdcd4269671e1d3cef1268947af3a.  It still passes the hidapi
test.  :-)

Let me know if anything’s amiss!

Thanks,
Ludo’.


This bug report was last modified 2 years and 80 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.