From: Junio C Hamano <gitster@pobox.com>
To: Siddharth Asthana <siddharthasthana31@gmail.com>
Cc: git@vger.kernel.org, karthik.188@gmail.com,
christian.couder@gmail.com, ps@pks.im, toon@iotcl.com
Subject: Re: [PATCH v3 1/1] cat-file: add mailmap subcommand to --batch-command
Date: Tue, 31 Mar 2026 12:21:20 -0700 [thread overview]
Message-ID: <xmqqo6k3ztxr.fsf@gitster.g> (raw)
In-Reply-To: <20260331121111.9614-2-siddharthasthana31@gmail.com> (Siddharth Asthana's message of "Tue, 31 Mar 2026 17:41:11 +0530")
Siddharth Asthana <siddharthasthana31@gmail.com> writes:
> 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 keeps interacting with a long-lived git-cat-file
> process and it would be useful if --batch-command supported toggling
> mailmap dynamically on an existing process.
>
> Add a `mailmap` subcommand to --batch-command that takes a boolean
> argument. The command now uses `git_parse_maybe_bool()` and supports all
> standard Git boolean values. Mailmap data is loaded lazily and kept in
I do not think you want to say "now uses `git_parse_maybe_bool()`".
Nobody is interested in the difference relative to what you did in
the previous iteration.
... that takes a boolean argument (usual ways you can specify a
boolean value like 'yes', 'true', etc., are supported).
> +static void load_mailmap(void)
> +{
> + if (mailmap.strdup_strings)
> + return;
> +
> + read_mailmap(the_repository, &mailmap);
> +}
This, especially the early return condition, may deserve a bit of
in-code comment, as "a used string_list has the .strdup_strings bit
set" is not a generally applicable rule.
/*
* The mailmap is initialized with .strdup_strings set to 0,
* but read_mailmap() sets the bit to 1 (this is true even when
* not a single mailmap entry is read), so it can be used for
* lazy loading.
*/
or something, perhaps?
> @@ -692,6 +700,21 @@ static void parse_cmd_info(struct batch_options *opt,
> batch_one_object(line, output, opt, data);
> }
>
> +static void parse_cmd_mailmap(struct batch_options *opt UNUSED,
> + const char *line,
> + struct strbuf *output UNUSED,
> + struct expand_data *data UNUSED)
> +{
> + int value = git_parse_maybe_bool(line);
As "line" is never NULL, one standard way to spell a boolean True is
not available to the callers, namely, "mailmap<EOL>" (like how a
configuration file entry "[core] bare" means "[core] bare = true"),
but that is probably OK. "mailmap<SP><EOL>" may be interpreted as
feeding an empty string as an argument, which is "false" to the
git_parse_maybe_bool() function. That might be surprising.
Nothing actionable in the above comment (other than perhaps as a
hint for documentation update).
> + if (value < 0)
> + die(_("mailmap: invalid boolean '%s'"), line);
> +
> + if (value > 0)
> + load_mailmap();
> + use_mailmap = value;
> +}
Hmph, why not use use_mailmap from the beginning of the function
without introducing the local variable "value"? Nothing in
load_mailmap() pays attention to the current value of use_mailmap
so I do not see much point in preserving the current status until
the last minute.
Thanks.
next prev parent reply other threads:[~2026-03-31 19:21 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-28 20:36 [PATCH v1 1/1] cat-file: add use-mailmap/no-use-mailmap to --batch-command Siddharth Asthana
2026-03-29 0:50 ` Junio C Hamano
2026-03-29 7:25 ` Siddharth Asthana
2026-03-29 20:55 ` Junio C Hamano
2026-03-29 8:28 ` [PATCH v2 0/1] cat-file: add mailmap subcommand " Siddharth Asthana
2026-03-29 8:28 ` [PATCH v2 1/1] " Siddharth Asthana
2026-03-30 2:12 ` Junio C Hamano
2026-03-31 1:40 ` Siddharth Asthana
2026-03-31 3:41 ` Junio C Hamano
2026-03-30 9:44 ` Karthik Nayak
2026-03-31 1:42 ` Siddharth Asthana
2026-03-30 10:37 ` Patrick Steinhardt
2026-03-30 14:53 ` Junio C Hamano
2026-03-31 1:43 ` Siddharth Asthana
2026-03-31 17:11 ` Jean-Noël AVILA
2026-03-31 17:49 ` Junio C Hamano
2026-04-01 10:11 ` Jean-Noël Avila
2026-03-31 12:11 ` [PATCH v3 0/1] " Siddharth Asthana
2026-03-31 12:11 ` [PATCH v3 1/1] " Siddharth Asthana
2026-03-31 19:21 ` Junio C Hamano [this message]
2026-04-10 18:29 ` Junio C Hamano
2026-04-15 15:09 ` [PATCH v4 0/1] " Siddharth Asthana
2026-04-15 15:09 ` [PATCH v4 1/1] " Siddharth Asthana
2026-04-15 18:28 ` Junio C Hamano
2026-04-16 3:08 ` Siddharth Asthana
2026-04-16 3:32 ` [PATCH v5 0/1] " Siddharth Asthana
2026-04-16 3:32 ` [PATCH v5 1/1] " Siddharth Asthana
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqo6k3ztxr.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=karthik.188@gmail.com \
--cc=ps@pks.im \
--cc=siddharthasthana31@gmail.com \
--cc=toon@iotcl.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox