[bug#77186,v2,02/13] services: gitolite-rc-file: Add log-extra field.

Message ID d7d54cea56cc096dfdc6e89c5432f06a2de59cb5.1742663354.git.~@wolfsden.cz
State New
Headers
Series [bug#77186,v2,01/13] services: gitolite-rc-file-compiler: Switch to match-record. |

Commit Message

Tomas Volf March 22, 2025, 5:09 p.m. UTC
  * gnu/services/version-control.scm (<gitolite-rc-file>): Add log-extra field.
(gitolite-rc-file-compiler): Handle it during configuration file generation.
* doc/guix.texi (Version Control Services): Document it.

Change-Id: Ice65dbdf4f42549e3c83914da7229db9d2cf856b
---
 doc/guix.texi                    | 7 +++++++
 gnu/services/version-control.scm | 9 ++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)
  

Comments

Maxim Cournoyer March 27, 2025, 5:40 a.m. UTC | #1
Hi Tomas,

Tomas Volf <~@wolfsden.cz> writes:

> * gnu/services/version-control.scm (<gitolite-rc-file>): Add log-extra field.
> (gitolite-rc-file-compiler): Handle it during configuration file generation.
> * doc/guix.texi (Version Control Services): Document it.

[...]

> +@item @code{log-extra} (default: @code{#f})
> +Whether gitolite should log extra details.
> +
> +For historical reasons, this field defaults to @code{#f}.  The default
> +value from gitolite however is @code{1} (written as @code{#t} in this
> +configuration).

Since this is newly introduced, what ar ethe historical reasons given?
Shouldn't it follows the default upstream behavior and default to #t?
  
Tomas Volf March 27, 2025, 5:38 p.m. UTC | #2
Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

> Hi Tomas,
>
> Tomas Volf <~@wolfsden.cz> writes:
>
>> * gnu/services/version-control.scm (<gitolite-rc-file>): Add log-extra field.
>> (gitolite-rc-file-compiler): Handle it during configuration file generation.
>> * doc/guix.texi (Version Control Services): Document it.
>
> [...]
>
>> +@item @code{log-extra} (default: @code{#f})
>> +Whether gitolite should log extra details.
>> +
>> +For historical reasons, this field defaults to @code{#f}.  The default
>> +value from gitolite however is @code{1} (written as @code{#t} in this
>> +configuration).
>
> Since this is newly introduced, what ar ethe historical reasons given?
> Shouldn't it follows the default upstream behavior and default to #t?

The problem is that the upstream default is done using the following
lines in the default configuration file (distributed with gitolite):

--8<---------------cut here---------------start------------->8---
    # comment out if you don't need all the extra detail in the logfile
    LOG_EXTRA                       =>  1,
--8<---------------cut here---------------end--------------->8---

Since we are generating our own configuration file from scratch, and it
does not include the LOG_EXTRA line, we have already changed the
behavior away from the default one, and I felt it necessary to keep it
that way.

Tomas
  

Patch

diff --git a/doc/guix.texi b/doc/guix.texi
index bcb1f9d9cf..3179d33cb3 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -41147,6 +41147,13 @@  Version Control Services
 Gitolite allows you to set git config values using the @samp{config}
 keyword.  This setting allows control over the config keys to accept.
 
+@item @code{log-extra} (default: @code{#f})
+Whether gitolite should log extra details.
+
+For historical reasons, this field defaults to @code{#f}.  The default
+value from gitolite however is @code{1} (written as @code{#t} in this
+configuration).
+
 @item @code{roles} (default: @code{'(("READERS" . 1) ("WRITERS" . ))})
 Set the role names allowed to be used by users running the perms command.
 
diff --git a/gnu/services/version-control.scm b/gnu/services/version-control.scm
index f5558e9197..344538a73e 100644
--- a/gnu/services/version-control.scm
+++ b/gnu/services/version-control.scm
@@ -60,6 +60,7 @@  (define-module (gnu services version-control)
             gitolite-rc-file-umask
             gitolite-rc-file-unsafe-pattern
             gitolite-rc-file-git-config-keys
+            gitolite-rc-file-log-extra
             gitolite-rc-file-roles
             gitolite-rc-file-enable
 
@@ -252,6 +253,8 @@  (define-record-type* <gitolite-rc-file>
                    (default #f))
   (git-config-keys gitolite-rc-file-git-config-keys
                    (default ""))
+  (log-extra       gitolite-rc-file-log-extra
+                   (default #f))
   (roles           gitolite-rc-file-roles
                    (default '(("READERS" . 1)
                               ("WRITERS" . 1))))
@@ -269,7 +272,8 @@  (define-record-type* <gitolite-rc-file>
 (define-gexp-compiler (gitolite-rc-file-compiler
                        (file <gitolite-rc-file>) system target)
   (match-record file <gitolite-rc-file>
-                (umask local-code unsafe-pattern git-config-keys roles enable)
+                ( umask local-code unsafe-pattern git-config-keys log-extra
+                  roles enable)
     (apply text-file* "gitolite.rc"
            `("%RC = (\n"
              "    UMASK => " ,(format #f "~4,'0o" umask) ",\n"
@@ -277,6 +281,9 @@  (define-gexp-compiler (gitolite-rc-file-compiler
              ,(if local-code
                   (simple-format #f "    LOCAL_CODE => \"~A\",\n" local-code)
                   "")
+             ,(if log-extra
+                  "    LOG_EXTRA => 1,\n"
+                  "")
              "    ROLES => {\n"
              ,@(map (match-lambda
                       ((role . value)