[bug#78437] gnu: git-minimal: Fix ugly output of git submodule -h.

Message ID 6f5549d0739acc350c4cd4dfaf45427e627e9fbf.1747294571.git.ngraves@ngraves.fr
State New
Headers
Series [bug#78437] gnu: git-minimal: Fix ugly output of git submodule -h. |

Commit Message

Nicolas Graves May 15, 2025, 7:21 a.m. UTC
* gnu/packages/version-control.scm (git-minimal)[arguments]<phases>:
Adjust the snippet patching git-submodule.sh to avoid the ugly
".git submodule-real" from git submodule -h.
---
 gnu/packages/version-control.scm | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
  

Comments

Ian Eure May 23, 2025, 4:36 a.m. UTC | #1
Hi Nicolas,

Nicolas Graves <ngraves@ngraves.fr> writes:

> * gnu/packages/version-control.scm 
> (git-minimal)[arguments]<phases>:
> Adjust the snippet patching git-submodule.sh to avoid the ugly
> ".git submodule-real" from git submodule -h.
> ---
>  gnu/packages/version-control.scm | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/gnu/packages/version-control.scm 
> b/gnu/packages/version-control.scm
> index ed96b524f83..f4bae91906d 100644
> --- a/gnu/packages/version-control.scm
> +++ b/gnu/packages/version-control.scm
> @@ -437,13 +437,11 @@ (define PATH-variable-definition
>                       "GNU")))           ;matched against '*'
>  
>                ;; git-submodule sources 'git-sh-setup.sh', but 
>                not before
> -              ;; invoking the basename and sed 
> commands... patch them to their
> -              ;; absolute location.
> +              ;; invoking the basename and sed commands... 
> Using those
> +              ;; leads to some ugly .git submodule-real, 
> hardcode instead.

The ".real" in the output is caused by the git package (which 
inherits from git-minimal) using `wrap-program' (which is what 
creates the ".real" files):

      ;; Tell 'git-submodule' where Perl is.
      (wrap-program git-sm
        `("PATH" ":" prefix
          (,(dirname (search-input-file inputs "bin/perl")))))

The git-minimal package has normal output:

    meson!ieure:~$ guix shell --pure git-minimal -- git submodule 
    -h
    usage: git submodule [--quiet] [--cached]

Since the problem is created by the git package, I think that’s 
were the fix should go.  WDYT?

Adding, the git-submodule script doesn’t call perl directly, so 
this must be due to it calling another git plumbing command which 
does -- `git-filter-branch' seems a likely suspect.  Though if 
that’s the case, git-minimal’s `git-filter-branch' is broken.  I’m 
not sure what the rationale is for doing it this way, but it might 
be worth checking if the wrapper can be eliminated altogether.

Thanks,

  -- Ian
  

Patch

diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index ed96b524f83..f4bae91906d 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -437,13 +437,11 @@  (define PATH-variable-definition
                      "GNU")))           ;matched against '*'
 
               ;; git-submodule sources 'git-sh-setup.sh', but not before
-              ;; invoking the basename and sed commands... patch them to their
-              ;; absolute location.
+              ;; invoking the basename and sed commands...  Using those
+              ;; leads to some ugly .git submodule-real, hardcode instead.
               (substitute* "git-submodule.sh"
-                (("\\$\\(basename")
-                 (string-append "$(" (search-input-file inputs "bin/basename")))
-                (("sed -e")
-                 (string-append (search-input-file inputs "bin/sed") " -e")))))
+                (("^dashless=.*")
+                 "dashless=\"git submodule\"\n"))))
           (add-after 'configure 'patch-makefiles
             (lambda _
               (substitute* "Makefile"