Subject: Re: [PATCH v2 2/7] fetch: add --negotiation-restrict option

From: Derrick Stolee <[email-masked]>
Date: Sun, 19 Apr 2026 19:00:11 -0400

On 4/15/26 5:57 PM, Junio C Hamano wrote:
> "Derrick Stolee via GitGitGadget" <[email-masked]> writes:
> 
>> -			warning("ignoring --negotiation-tip=%s because it does not match any refs",
>> -				s);
>> +			warning(_("ignoring %s=%s because it does not match any refs"),
>> +				"--negotiation-restrict", s);
>> -			warning("ignoring --negotiation-tip because the protocol does not support it");
>> +			warning(_("ignoring %s because the protocol does not support it"),
>> +				"--negotiation-restrict");
> 
> These are nice touches to make sure translators cannot possibly
> botch these option names that must be given verbatim.

 >> @@ -2657,7 +2660,7 @@ int cmd_fetch(int argc,
 >>   	}
 >>
 >>   	if (negotiate_only && !negotiation_tip.nr)
 >> -		die(_("--negotiate-only needs one or more --negotiation-tip=*"));
 >> +		die(_("--negotiate-only needs one or more --negotiation-restrict=*"));
 >
 > OK.  Shouldn't this also do the "%s" thing?

I think I had focused on adding "%s" to strings that were not
previously translated, but adjusting the string under translation
is enough to require retranslation. I should make it easier to
translate, too.

>>   	}
>>   	return transport;
>>   }
>> @@ -2567,6 +2568,8 @@ int cmd_fetch(int argc,
>>   		OPT_IPVERSION(&family),
>>   		OPT_STRING_LIST(0, "negotiation-tip", &negotiation_tip, N_("revision"),
>>   				N_("report that we have only objects reachable from this object")),
>> +		OPT_STRING_LIST(0, "negotiation-restrict", &negotiation_tip, N_("revision"),
>> +				N_("report that we have only objects reachable from this object")),
> 
> Is OPT_ALIAS() suitable for this?

I was not aware of this. Thanks for the pointer!

I do plan to make "negotiation-tip" an alias for "negotiation-restrict"
based on the new preference for *-restrict as the "real" option now. Is
that the right way to do this?

Thanks,
-Stolee