diff mbox series

[bug#72813] gnu: packages: Fix git system configuration.

Message ID 1ea5ce3850cc9e91526391e315061f8e0c523f8c.1724643373.git.lilah@lunabee.space
State New
Headers show
Series [bug#72813] gnu: packages: Fix git system configuration. | expand

Commit Message

Lilah Tascheter Aug. 26, 2024, 3:36 a.m. UTC
Git's system config path is, by default, relative to the install prefix.
Fix this to use the usual system path.

System config is is pretty much the only way to change git config for
system services.

* gnu/packages/version-control.scm (git/fixed): New variable.
  (git)[replacement]: Graft with git/fixed.

Change-Id: I44ae667baee6c9389a8f81da743d67d1a63070ed
---
 gnu/packages/version-control.scm | 9 +++++++++
 1 file changed, 9 insertions(+)


base-commit: 9e57f3bcd4b3c4c8936358d3160f0d4f996204ce

Comments

Ludovic Courtès Oct. 12, 2024, 5:07 p.m. UTC | #1
Hi Lilah,

Lilah Tascheter <lilah@lunabee.space> skribis:

> Git's system config path is, by default, relative to the install prefix.
> Fix this to use the usual system path.
>
> System config is is pretty much the only way to change git config for
> system services.
>
> * gnu/packages/version-control.scm (git/fixed): New variable.
>   (git)[replacement]: Graft with git/fixed.
>
> Change-Id: I44ae667baee6c9389a8f81da743d67d1a63070ed

Apologies for the delay.

In general we would use ‘replacement’ only for security issues.  In this
case I would suggest changing #:configure-flags in ‘git-minimal’ *and*
arrange so that ‘git-minimal/pinned’ remains unchanged (that is, it
should still have the previous #:configure-flags value).

You can check that by running:

  ./pre-inst-env guix build \
    -e '(@ (gnu packages version-control) git-minimal/pinned)' \
    --no-grafts -d

before and after your change.  The result should be identical.

Would you like to give it a try?

Thanks,
Ludo’.
diff mbox series

Patch

diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 42bd4a5744..efb91da8af 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -251,6 +251,7 @@  (define-public git
             (sha256
              (base32
               "1nws1vjgj54sv32wxl1h3n1jkcpabqv7a605hhafsby0n5zfigsi"))))
+   (replacement git/fixed)
    (build-system gnu-build-system)
    (native-inputs
     `(("native-perl" ,perl)
@@ -629,6 +630,14 @@  (define-public git
     (license license:gpl2)
     (home-page "https://git-scm.com/")))
 
+(define git/fixed
+  (package
+    (inherit git)
+    (arguments
+      (substitute-keyword-arguments (package-arguments git)
+        ((#:configure-flags flags #~'())
+         #~(cons "--with-gitconfig=/etc/gitconfig" #$flags))))))
+
 (define-public git-minimal
   ;; The size of the closure of 'git-minimal' is two thirds that of 'git'.
   ;; Its test suite runs slightly faster and most importantly it doesn't