Subject: Re: [PATCH] usage: clarify --recurse-submodules as a boolean

From: Junio C Hamano <[email-masked]>
Date: Fri, 07 Apr 2023 17:59:53 -0700

Emily Shaffer <[email-masked]> writes:

> I think we do because config_update_recurse_submodules is static to
> submodule.c - that is, builtin/checkout.c and friends don't have access
> to set it manually with OPT_BOOL. Using the callback just to set static
> state we don't naturally have access to is pretty awful, though, so I'd
> be in favor of plumbing it through like other options we might be
> passing to the submodule machinery.

Yes, the cleanest way to interface into that part of the submodule
machinery that wants to use a hidden static state would be to

 (1) implement a setter interface in the submodule machinery for
     that hidden static state, and

 (2) use the bog-standard OPT_BOOL() on an on-stack variable of
     cmd_checkout() and friends, and use that setter interface after
     parse_options() returns.

Then you can avoid the "pretty awful" arrangement today's code has.

Note that such a clean-up can be done independent of how an option
that yields a Boolean value can be spelled, i.e. whether we'd accept
--frotz=yes or only take --[no-]frotz.