Re: [PATCH v2 1/1] cat-file: add mailmap subcommand to --batch-command
Jean-Noël AVILA <jn.avila@free.fr> writes:
Show 40 quoted lines
> On Sunday, 29 March 2026 10:28:08 CEST Siddharth Asthana wrote:
>> git-cat-file(1)'s --batch-command works with the --use-mailmap option,
>> but this option needs to be set when the process is created. This means
>> we cannot change this option mid-operation.
>>
>> At GitLab, Gitaly caches git-cat-file processes and it would be useful
>> if --batch-command supported toggling mailmap dynamically with existing
>> processes.
>>
>> Add a `mailmap` subcommand to --batch-command that takes a single
>> argument: `yes` to enable mailmap and `no` to disable it. When enabled,
>> mailmap data is loaded from disk on first use and kept in memory so that
>> toggling back on does not require reloading.
>>
>> Suggested-by: Junio C Hamano <gitster@pobox.com>
>> Signed-off-by: Siddharth Asthana <siddharthasthana31@gmail.com>
>> ---
>> CI: https://gitlab.com/gitlab-org/git/-/pipelines/2416081861
>>
>> Documentation/git-cat-file.adoc | 7 +++++
>> builtin/cat-file.c | 30 ++++++++++++++++++---
>> t/t4203-mailmap.sh | 48 +++++++++++++++++++++++++++++++++
>> 3 files changed, 81 insertions(+), 4 deletions(-)
>>
>> diff --git a/Documentation/git-cat-file.adoc b/Documentation/git-cat-
> file.adoc
>> index c139f55a16..af32e929a8 100644
>> --- a/Documentation/git-cat-file.adoc
>> +++ b/Documentation/git-cat-file.adoc
>> @@ -174,6 +174,13 @@ flush::
>> since the beginning or since the last flush was issued. When `--
> buffer`
>> is used, no output will come until a `flush` is issued. When `--
> buffer`
>> is not used, commands are flushed each time without issuing `flush`.
>> +
>> +mailmap <yes|no>::
>
> `yes` and `no` are keywords, and you want to express an alternative, do it
> like this: `mailmap (yes|no)::`.
Not
`mailmap (yes|no)`::
IOW, shouldn't the closing quote come before the double-colon?
Show 21 quoted lines
>> + Enable or disable mailmap for subsequent `contents` and `info`
>> + commands. When `yes` is given, mailmap data is loaded from disk on
>> + first use and kept in memory; passing `yes` again does not reload
> it.
>> + When `no` is given, mailmap is disabled but the data stays in memory
>> + so that a later `mailmap yes` does not need to reload it from disk.
>> --
>> +
>>
>
> Instead of detailing the alternatives in the same chapter, you could break it
> into a sub-list:
>
> Enable or disalbe mailmap for subsequent `contents` and `info` commands.
> Possible values are:
> `yes`;;
> mailmap data is loaded from disk on first use and kept in memory; passing
> `yes` again does not reload it.
> `no`;;
> mailmap is disabled but the data stays in memory so that a later `mailmap yes`
> does not need to reload it from disk.