* [PATCH] am, rebase: fix arghelp syntax of --empty
@ 2023-10-28 11:58 René Scharfe
2023-10-29 6:24 ` Elijah Newren
0 siblings, 1 reply; 2+ messages in thread
From: René Scharfe @ 2023-10-28 11:58 UTC (permalink / raw)
To: Git List; +Cc: Elijah Newren, 徐沛文 (Aleen)
Use parentheses and pipes to present alternatives in the argument help
for the --empty options of git am and git rebase, like in the rest of
the documentation.
While at it remove a stray use of the enum empty_action value
STOP_ON_EMPTY_COMMIT to indicate that no short option is present.
While it has a value of 0 and thus there is no user-visible change,
that enum is not meant to hold short option characters. Hard-code 0,
like we do for other options without a short option.
Signed-off-by: René Scharfe <l.s.r@web.de>
---
Documentation/git-rebase.txt | 4 ++--
builtin/am.c | 2 +-
builtin/rebase.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index e7b39ad244..b4526ca246 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -289,7 +289,7 @@ See also INCOMPATIBLE OPTIONS below.
+
See also INCOMPATIBLE OPTIONS below.
---empty={drop,keep,ask}::
+--empty=(drop|keep|ask)::
How to handle commits that are not empty to start and are not
clean cherry-picks of any upstream commit, but which become
empty after rebasing (because they contain a subset of already
@@ -695,7 +695,7 @@ be dropped automatically with `--no-keep-empty`).
Similar to the apply backend, by default the merge backend drops
commits that become empty unless `-i`/`--interactive` is specified (in
which case it stops and asks the user what to do). The merge backend
-also has an `--empty={drop,keep,ask}` option for changing the behavior
+also has an `--empty=(drop|keep|ask)` option for changing the behavior
of handling commits that become empty.
Directory rename detection
diff --git a/builtin/am.c b/builtin/am.c
index 6655059a57..9bb73d1671 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -2420,7 +2420,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)
{ OPTION_STRING, 'S', "gpg-sign", &state.sign_commit, N_("key-id"),
N_("GPG-sign commits"),
PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
- OPT_CALLBACK_F(STOP_ON_EMPTY_COMMIT, "empty", &state.empty_type, "{stop,drop,keep}",
+ OPT_CALLBACK_F(0, "empty", &state.empty_type, "(stop|drop|keep)",
N_("how to handle empty patches"),
PARSE_OPT_NONEG, am_option_parse_empty),
OPT_HIDDEN_BOOL(0, "rebasing", &state.rebasing,
diff --git a/builtin/rebase.c b/builtin/rebase.c
index f990811614..ad7baedd4a 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -1147,7 +1147,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
"instead of ignoring them"),
1, PARSE_OPT_HIDDEN),
OPT_RERERE_AUTOUPDATE(&options.allow_rerere_autoupdate),
- OPT_CALLBACK_F(0, "empty", &options, "{drop,keep,ask}",
+ OPT_CALLBACK_F(0, "empty", &options, "(drop|keep|ask)",
N_("how to handle commits that become empty"),
PARSE_OPT_NONEG, parse_opt_empty),
OPT_CALLBACK_F('k', "keep-empty", &options, NULL,
--
2.42.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] am, rebase: fix arghelp syntax of --empty
2023-10-28 11:58 [PATCH] am, rebase: fix arghelp syntax of --empty René Scharfe
@ 2023-10-29 6:24 ` Elijah Newren
0 siblings, 0 replies; 2+ messages in thread
From: Elijah Newren @ 2023-10-29 6:24 UTC (permalink / raw)
To: René Scharfe; +Cc: Git List, 徐沛文 (Aleen)
On Sat, Oct 28, 2023 at 4:58 AM René Scharfe <l.s.r@web.de> wrote:
>
> Use parentheses and pipes to present alternatives in the argument help
> for the --empty options of git am and git rebase, like in the rest of
> the documentation.
>
> While at it remove a stray use of the enum empty_action value
> STOP_ON_EMPTY_COMMIT to indicate that no short option is present.
> While it has a value of 0 and thus there is no user-visible change,
> that enum is not meant to hold short option characters. Hard-code 0,
> like we do for other options without a short option.
>
> Signed-off-by: René Scharfe <l.s.r@web.de>
> ---
> Documentation/git-rebase.txt | 4 ++--
> builtin/am.c | 2 +-
> builtin/rebase.c | 2 +-
> 3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
> index e7b39ad244..b4526ca246 100644
> --- a/Documentation/git-rebase.txt
> +++ b/Documentation/git-rebase.txt
> @@ -289,7 +289,7 @@ See also INCOMPATIBLE OPTIONS below.
> +
> See also INCOMPATIBLE OPTIONS below.
>
> ---empty={drop,keep,ask}::
> +--empty=(drop|keep|ask)::
> How to handle commits that are not empty to start and are not
> clean cherry-picks of any upstream commit, but which become
> empty after rebasing (because they contain a subset of already
> @@ -695,7 +695,7 @@ be dropped automatically with `--no-keep-empty`).
> Similar to the apply backend, by default the merge backend drops
> commits that become empty unless `-i`/`--interactive` is specified (in
> which case it stops and asks the user what to do). The merge backend
> -also has an `--empty={drop,keep,ask}` option for changing the behavior
> +also has an `--empty=(drop|keep|ask)` option for changing the behavior
> of handling commits that become empty.
>
> Directory rename detection
> diff --git a/builtin/am.c b/builtin/am.c
> index 6655059a57..9bb73d1671 100644
> --- a/builtin/am.c
> +++ b/builtin/am.c
> @@ -2420,7 +2420,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)
> { OPTION_STRING, 'S', "gpg-sign", &state.sign_commit, N_("key-id"),
> N_("GPG-sign commits"),
> PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
> - OPT_CALLBACK_F(STOP_ON_EMPTY_COMMIT, "empty", &state.empty_type, "{stop,drop,keep}",
> + OPT_CALLBACK_F(0, "empty", &state.empty_type, "(stop|drop|keep)",
> N_("how to handle empty patches"),
> PARSE_OPT_NONEG, am_option_parse_empty),
> OPT_HIDDEN_BOOL(0, "rebasing", &state.rebasing,
> diff --git a/builtin/rebase.c b/builtin/rebase.c
> index f990811614..ad7baedd4a 100644
> --- a/builtin/rebase.c
> +++ b/builtin/rebase.c
> @@ -1147,7 +1147,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
> "instead of ignoring them"),
> 1, PARSE_OPT_HIDDEN),
> OPT_RERERE_AUTOUPDATE(&options.allow_rerere_autoupdate),
> - OPT_CALLBACK_F(0, "empty", &options, "{drop,keep,ask}",
> + OPT_CALLBACK_F(0, "empty", &options, "(drop|keep|ask)",
> N_("how to handle commits that become empty"),
> PARSE_OPT_NONEG, parse_opt_empty),
> OPT_CALLBACK_F('k', "keep-empty", &options, NULL,
> --
> 2.42.0
Looks good to me; thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-29 6:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-28 11:58 [PATCH] am, rebase: fix arghelp syntax of --empty René Scharfe
2023-10-29 6:24 ` Elijah Newren
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 NNTP newsgroup(s).