Subject: Re: [PATCH v2 1/1] cat-file: add mailmap subcommand to --batch-command

From: Junio C Hamano <[email-masked]>
Date: Mon, 30 Mar 2026 20:41:18 -0700

Siddharth Asthana <[email-masked]> writes:

>>   * Can we somehow make mailmap object itself slightly smarter so
>>     that it knows if it has already been asked to read the data from
>>     its sources?  It is a pretty dumb string_list, but from a cursory
>>     read of the code flow, it seems that mailmap.strdup_strings is
>>     initialized to be false in builtin/cat-file.c and then one of the
>>     first things done in mailmap.c::read_mailmap() is to flip that
>>     bit on, so the "yes" part of the parse_cmd_mailmap() might become
>> 
>> 	if (yes)
>> 		load_mailmap();
>> 
>>     with the helper load_mailmap() that may look like:

This part was a bit misstated.  What I meant was more like

	if (!strcmp(...yes))
		use_mailmap = 1;
	else if (!strcmp(...no))
		use_mailmap = 0;
	else
		die(_("misconfigured"));

	if (use_mailmap)
		load_mailmap();