Skip to content

Commit f7c1b23

Browse files
rscharfegitster
authored andcommitted
am, rebase: fix arghelp syntax of --empty
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 43c8a30 commit f7c1b23

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Documentation/git-rebase.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ See also INCOMPATIBLE OPTIONS below.
289289
+
290290
See also INCOMPATIBLE OPTIONS below.
291291

292-
--empty={drop,keep,ask}::
292+
--empty=(drop|keep|ask)::
293293
How to handle commits that are not empty to start and are not
294294
clean cherry-picks of any upstream commit, but which become
295295
empty after rebasing (because they contain a subset of already
@@ -695,7 +695,7 @@ be dropped automatically with `--no-keep-empty`).
695695
Similar to the apply backend, by default the merge backend drops
696696
commits that become empty unless `-i`/`--interactive` is specified (in
697697
which case it stops and asks the user what to do). The merge backend
698-
also has an `--empty={drop,keep,ask}` option for changing the behavior
698+
also has an `--empty=(drop|keep|ask)` option for changing the behavior
699699
of handling commits that become empty.
700700

701701
Directory rename detection

builtin/am.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2419,7 +2419,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)
24192419
{ OPTION_STRING, 'S', "gpg-sign", &state.sign_commit, N_("key-id"),
24202420
N_("GPG-sign commits"),
24212421
PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
2422-
OPT_CALLBACK_F(STOP_ON_EMPTY_COMMIT, "empty", &state.empty_type, "{stop,drop,keep}",
2422+
OPT_CALLBACK_F(0, "empty", &state.empty_type, "(stop|drop|keep)",
24232423
N_("how to handle empty patches"),
24242424
PARSE_OPT_NONEG, am_option_parse_empty),
24252425
OPT_HIDDEN_BOOL(0, "rebasing", &state.rebasing,

builtin/rebase.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
11471147
"instead of ignoring them"),
11481148
1, PARSE_OPT_HIDDEN),
11491149
OPT_RERERE_AUTOUPDATE(&options.allow_rerere_autoupdate),
1150-
OPT_CALLBACK_F(0, "empty", &options, "{drop,keep,ask}",
1150+
OPT_CALLBACK_F(0, "empty", &options, "(drop|keep|ask)",
11511151
N_("how to handle commits that become empty"),
11521152
PARSE_OPT_NONEG, parse_opt_empty),
11531153
OPT_CALLBACK_F('k', "keep-empty", &options, NULL,

0 commit comments

Comments
 (0)