From: Junio C Hamano <gitster@pobox.com>
To: Emily Shaffer <nasamuffin@google.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v2] usage: clarify --recurse-submodules as a boolean
Date: Mon, 10 Apr 2023 16:10:40 -0700 [thread overview]
Message-ID: <xmqqfs97cozz.fsf@gitster.g> (raw)
In-Reply-To: <ZDSTFwMFO7vbj/du@google.com> (Emily Shaffer's message of "Mon, 10 Apr 2023 15:52:07 -0700")
Emily Shaffer <nasamuffin@google.com> writes:
> `git switch` `git checkout`, `git reset`, and `git read-tree` allow a
Missing comma?
> user to choose to recurse into submodules. All four of these commands'
> short usage seems to indicate that `--recurse-submodules` should take an
> argument. In practice, though, all four of these commands parse through
> the same callback path:
>
> option_parse_recurse_submodules_worktree_updater(...) checks for
> set/unset, or passes off to...
> parse_update_recurse_submodules_arg(...), which is a straight handoff
> to...
> parse_update_recurse(...), which only accepts true or false.
"true or false" -> "various forms of 'true' (e.g. on/1/yes) or 'false'"
> So ultimately, it can only be true or false, unlike `git push
Likewise. Here is a minimally touched up version I queued.
Thanks.
usage: clarify --recurse-submodules as a boolean
`git switch`, `git checkout`, `git reset`, and `git read-tree` allow a
user to choose to recurse into submodules. All four of these commands'
short usage seems to indicate that `--recurse-submodules` should take an
argument. In practice, though, all four of these commands parse through
the same callback path:
option_parse_recurse_submodules_worktree_updater(...) checks for
set/unset, or passes off to...
parse_update_recurse_submodules_arg(...), which is a straight handoff
to...
parse_update_recurse(...), which only accepts various ways to
spell a Boolean
So ultimately, it can only be true or false (or yes/no/on/off/etc),
unlike `git push --recurse-submodules=<enum>`. A user could provide
`--recurse-submodules=true`, but we don't typically suggest that for
boolean arguments.
Documentation/git-(switch|checkout|reset|read-tree).txt suggests
--[no-]recurse-submodules, too.
In fact, these four commands are the only ones that use this codepath -
so there's not any reason for it to be so meandering. However, because
option_parse_recurse_submodules_worktree_updater() modifies static state
in submodule.c, we still need to get a handle to that static state
through a function call.
To preserve the behavior of --recurse-submodules=true and clarify the
usage string simultaneously, get rid of the OPT_CALLBACK_F in favor of a
simple OPT_BOOL, and call a setter in submodule.c for the static state
instead. Also, remove the now-unused
option_parse_recurse_submodules_worktree_updater(),
parse_update_recurse_submodules_arg(), and parse_update_recurse() calls.
Signed-off-by: Emily Shaffer <nasamuffin@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
next prev parent reply other threads:[~2023-04-10 23:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-07 22:18 [PATCH] usage: clarify --recurse-submodules as a boolean Emily Shaffer
2023-04-07 23:47 ` Junio C Hamano
2023-04-08 0:03 ` Junio C Hamano
2023-04-08 0:22 ` Emily Shaffer
2023-04-08 0:59 ` Junio C Hamano
2023-04-10 16:41 ` Emily Shaffer
2023-04-08 0:07 ` Emily Shaffer
2023-04-10 23:07 ` Junio C Hamano
2023-04-10 22:52 ` [PATCH v2] " Emily Shaffer
2023-04-10 23:10 ` Junio C Hamano [this message]
2023-05-05 17:30 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqfs97cozz.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=nasamuffin@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).