Re: [PATCH v2 2/7] fetch: add --negotiation-restrict option
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Apr 19, 2026, 23:00 UTC
- Message-ID
- <5370b884-30e8-44a9-a52e-4c518556fa24@gmail.com>
- In-Reply-To
- <xmqq1pgf6g5g.fsf@gitster.g>
On 4/15/26 5:57 PM, Junio C Hamano wrote:
Show 12 quoted lines
> "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> 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.
Show 11 quoted lines
>> }
>> 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