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

From: Junio C Hamano <[email-masked]>
Date: Mon, 20 Apr 2026 03:32:38 -0700

Derrick Stolee <[email-masked]> writes:

>>>   		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?

Let's see.

$ git grep OPT_ALIAS builtin/clone.c
builtin/clone.c:		OPT_ALIAS(0, "recursive", "recurse-submodules"),
$ git clone -h
usage: git clone [<options>] [--] <repo> [<dir>]

    -v, --[no-]verbose    be more verbose
    -q, --[no-]quiet      be more quiet
    ...
    --[no-]recurse-submodules[=<pathspec>]
                          initialize submodules in the clone
    --[no-]recursive[=<pathspec>]
                          alias of --recurse-submodules
    ...

I think we gave the operation the name "recursive", with a common
short sightedness that anything we are adding "recursive" for is the
only kind of recursiveness, and then prepared for a future where
things other than submodules can also be sources of recursiveness by
making "recurse-submodules" the official name, while still allowing
historical name as the synonym.

In this case, if "-restrict" will become the official name, it
should be listed first, and then the historical name should be made
its alias.

So

	OPT_STRING_LIST(0, "negotiation-restrict", &negotiation_tip, ...),
	OPT_ALIAS(0, "negotiation-tip", "negotiation-restrict"),

would be the right combination in the correct order, I think.
Mention the official thing first, and then tell that another thing
is an alias to what the readers have already seen after that (e.g.,
c28b036f (clone: reorder --recursive/--recurse-submodules,
2020-03-16)).