guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#61910] [PATCH] git-download: Download a bare Git repository from SW


From: Ludovic Courtès
Subject: [bug#61910] [PATCH] git-download: Download a bare Git repository from SWH.
Date: Thu, 02 Mar 2023 14:15:05 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

Hello!

Simon Tournier <zimon.toutoune@gmail.com> skribis:


[...]

>                         (swh-download (getenv "git url") (getenv "git commit")
> -                                     #$output))))))))
> +                                     #$output)
> +                       ;; Perform CR/LF conversion if specificied by 
> .gitattributes
> +                       (when (find-files "." ".gitattributes")
> +                         (invoke #+(file-append git "/bin/git") "-C" #$output
> +                                 "init")
> +                         (invoke #+(file-append git "/bin/git") "-C" #$output
> +                                 "config" "--local" "user.email" 
> "you@example.org")
> +                         (invoke #+(file-append git "/bin/git") "-C" #$output
> +                                 "config" "--local" "user.name" "Your Name")
> +                         (invoke #+(file-append git "/bin/git") "-C" #$output
> +                                 "add" ".")
> +                         (invoke #+(file-append git "/bin/git") "-C" #$output
> +                                 "commit" "-am" "'init'")
> +                         (invoke #+(file-append git "/bin/git") "-C" #$output
> +                                 "read-tree" "--empty")
> +                         (invoke #+(file-append git "/bin/git") "-C" #$output
> +                                 "reset" "--hard")
> +                         (delete-file-recursively
> +                          (string-append #$output "/.git"))))))))))

This is much better than fetching the whole repo, well done!

Should we replace (find-files …) with (file-exists? ".gitattributes")?

I wonder if we could achieve the same without creating a repo just to
delete it afterwards, either by invoking a low-level ‘git’ command it if
exists, or using Guile-Git, or doing it ourselves in Scheme.

WDYT?

Thanks,
Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]