all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#61910] [PATCH] git-download: Download a bare Git repository from SWH.
@ 2023-03-02  9:12 Ludovic Courtès
  2023-03-02 10:30 ` Simon Tournier
  2023-03-02 12:05 ` [bug#61910] [PATCH v2] git-download: Apply CR/LF to " Simon Tournier
  0 siblings, 2 replies; 9+ messages in thread
From: Ludovic Courtès @ 2023-03-02  9:12 UTC (permalink / raw)
  To: 61910; +Cc: Ludovic Courtès, Simon Tournier, Valentin Lorentz

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@inserm.fr>.
Suggested by Valentin Lorentz <valentin.lorentz@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@gnu.org>
+;;; Copyright © 2014-2021, 2023 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2017 Mathieu Lirzin <mthl@gnu.org>
 ;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
 ;;; Copyright © 2020 Jakub Kądziołka <kuba@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





^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-03-03 19:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-02  9:12 [bug#61910] [PATCH] git-download: Download a bare Git repository from SWH Ludovic Courtès
2023-03-02 10:30 ` Simon Tournier
2023-03-02 12:05 ` [bug#61910] [PATCH v2] git-download: Apply CR/LF to " Simon Tournier
2023-03-02 13:15   ` [bug#61910] [PATCH] git-download: Download a bare " Ludovic Courtès
2023-03-02 13:50     ` Simon Tournier
2023-03-02 17:42       ` Simon Tournier
2023-03-03 11:12       ` Ludovic Courtès
2023-03-03 13:27         ` bug#61910: " Ludovic Courtès
2023-03-03 18:52           ` [bug#61910] " Simon Tournier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.