{"thread":{"id":"60439","subject":"[PATCH] am, rebase: fix arghelp syntax of --empty","startedAt":"2023-10-28T11:58:17Z","lastAt":"2023-10-29T06:24:55Z","messageCount":2,"participants":["René Scharfe","Elijah Newren"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"484024","messageId":"10e09b2d-15d7-4af1-b24c-217f9e2f457a@web.de","threadId":"60439","inReplyTo":null,"subject":"[PATCH] am, rebase: fix arghelp syntax of --empty","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2023-10-28T11:58:07Z","receivedAt":"2023-10-28T11:58:17Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Use parentheses and pipes to present alternatives in the argument help\nfor the --empty options of git am and git rebase, like in the rest of\nthe documentation.\n\nWhile at it remove a stray use of the enum empty_action value\nSTOP_ON_EMPTY_COMMIT to indicate that no short option is present.\nWhile it has a value of 0 and thus there is no user-visible change,\nthat enum is not meant to hold short option characters.  Hard-code 0,\nlike we do for other options without a short option.\n\nSigned-off-by: René Scharfe <l.s.r@web.de>\n---\n Documentation/git-rebase.txt | 4 ++--\n builtin/am.c                 | 2 +-\n builtin/rebase.c             | 2 +-\n 3 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex e7b39ad244..b4526ca246 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -289,7 +289,7 @@ See also INCOMPATIBLE OPTIONS below.\n +\n See also INCOMPATIBLE OPTIONS below.\n\n---empty={drop,keep,ask}::\n+--empty=(drop|keep|ask)::\n \tHow to handle commits that are not empty to start and are not\n \tclean cherry-picks of any upstream commit, but which become\n \tempty after rebasing (because they contain a subset of already\n@@ -695,7 +695,7 @@ be dropped automatically with `--no-keep-empty`).\n Similar to the apply backend, by default the merge backend drops\n commits that become empty unless `-i`/`--interactive` is specified (in\n which case it stops and asks the user what to do).  The merge backend\n-also has an `--empty={drop,keep,ask}` option for changing the behavior\n+also has an `--empty=(drop|keep|ask)` option for changing the behavior\n of handling commits that become empty.\n\n Directory rename detection\ndiff --git a/builtin/am.c b/builtin/am.c\nindex 6655059a57..9bb73d1671 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -2420,7 +2420,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)\n \t\t{ OPTION_STRING, 'S', \"gpg-sign\", &state.sign_commit, N_(\"key-id\"),\n \t\t  N_(\"GPG-sign commits\"),\n \t\t  PARSE_OPT_OPTARG, NULL, (intptr_t) \"\" },\n-\t\tOPT_CALLBACK_F(STOP_ON_EMPTY_COMMIT, \"empty\", &state.empty_type, \"{stop,drop,keep}\",\n+\t\tOPT_CALLBACK_F(0, \"empty\", &state.empty_type, \"(stop|drop|keep)\",\n \t\t  N_(\"how to handle empty patches\"),\n \t\t  PARSE_OPT_NONEG, am_option_parse_empty),\n \t\tOPT_HIDDEN_BOOL(0, \"rebasing\", &state.rebasing,\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex f990811614..ad7baedd4a 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -1147,7 +1147,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \t\t\t\t \"instead of ignoring them\"),\n \t\t\t      1, PARSE_OPT_HIDDEN),\n \t\tOPT_RERERE_AUTOUPDATE(&options.allow_rerere_autoupdate),\n-\t\tOPT_CALLBACK_F(0, \"empty\", &options, \"{drop,keep,ask}\",\n+\t\tOPT_CALLBACK_F(0, \"empty\", &options, \"(drop|keep|ask)\",\n \t\t\t       N_(\"how to handle commits that become empty\"),\n \t\t\t       PARSE_OPT_NONEG, parse_opt_empty),\n \t\tOPT_CALLBACK_F('k', \"keep-empty\", &options, NULL,\n--\n2.42.0\n"},{"id":"484044","messageId":"CABPp-BGF8URaTqqZ-CSbghjTwJtPNGv6zEws38r8qS650y=FSw@mail.gmail.com","threadId":"60439","inReplyTo":"10e09b2d-15d7-4af1-b24c-217f9e2f457a@web.de","subject":"Re: [PATCH] am, rebase: fix arghelp syntax of --empty","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-10-29T06:24:37Z","receivedAt":"2023-10-29T06:24:55Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Sat, Oct 28, 2023 at 4:58 AM René Scharfe <l.s.r@web.de> wrote:\n>\n> Use parentheses and pipes to present alternatives in the argument help\n> for the --empty options of git am and git rebase, like in the rest of\n> the documentation.\n>\n> While at it remove a stray use of the enum empty_action value\n> STOP_ON_EMPTY_COMMIT to indicate that no short option is present.\n> While it has a value of 0 and thus there is no user-visible change,\n> that enum is not meant to hold short option characters.  Hard-code 0,\n> like we do for other options without a short option.\n>\n> Signed-off-by: René Scharfe <l.s.r@web.de>\n> ---\n>  Documentation/git-rebase.txt | 4 ++--\n>  builtin/am.c                 | 2 +-\n>  builtin/rebase.c             | 2 +-\n>  3 files changed, 4 insertions(+), 4 deletions(-)\n>\n> diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\n> index e7b39ad244..b4526ca246 100644\n> --- a/Documentation/git-rebase.txt\n> +++ b/Documentation/git-rebase.txt\n> @@ -289,7 +289,7 @@ See also INCOMPATIBLE OPTIONS below.\n>  +\n>  See also INCOMPATIBLE OPTIONS below.\n>\n> ---empty={drop,keep,ask}::\n> +--empty=(drop|keep|ask)::\n>         How to handle commits that are not empty to start and are not\n>         clean cherry-picks of any upstream commit, but which become\n>         empty after rebasing (because they contain a subset of already\n> @@ -695,7 +695,7 @@ be dropped automatically with `--no-keep-empty`).\n>  Similar to the apply backend, by default the merge backend drops\n>  commits that become empty unless `-i`/`--interactive` is specified (in\n>  which case it stops and asks the user what to do).  The merge backend\n> -also has an `--empty={drop,keep,ask}` option for changing the behavior\n> +also has an `--empty=(drop|keep|ask)` option for changing the behavior\n>  of handling commits that become empty.\n>\n>  Directory rename detection\n> diff --git a/builtin/am.c b/builtin/am.c\n> index 6655059a57..9bb73d1671 100644\n> --- a/builtin/am.c\n> +++ b/builtin/am.c\n> @@ -2420,7 +2420,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)\n>                 { OPTION_STRING, 'S', \"gpg-sign\", &state.sign_commit, N_(\"key-id\"),\n>                   N_(\"GPG-sign commits\"),\n>                   PARSE_OPT_OPTARG, NULL, (intptr_t) \"\" },\n> -               OPT_CALLBACK_F(STOP_ON_EMPTY_COMMIT, \"empty\", &state.empty_type, \"{stop,drop,keep}\",\n> +               OPT_CALLBACK_F(0, \"empty\", &state.empty_type, \"(stop|drop|keep)\",\n>                   N_(\"how to handle empty patches\"),\n>                   PARSE_OPT_NONEG, am_option_parse_empty),\n>                 OPT_HIDDEN_BOOL(0, \"rebasing\", &state.rebasing,\n> diff --git a/builtin/rebase.c b/builtin/rebase.c\n> index f990811614..ad7baedd4a 100644\n> --- a/builtin/rebase.c\n> +++ b/builtin/rebase.c\n> @@ -1147,7 +1147,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n>                                  \"instead of ignoring them\"),\n>                               1, PARSE_OPT_HIDDEN),\n>                 OPT_RERERE_AUTOUPDATE(&options.allow_rerere_autoupdate),\n> -               OPT_CALLBACK_F(0, \"empty\", &options, \"{drop,keep,ask}\",\n> +               OPT_CALLBACK_F(0, \"empty\", &options, \"(drop|keep|ask)\",\n>                                N_(\"how to handle commits that become empty\"),\n>                                PARSE_OPT_NONEG, parse_opt_empty),\n>                 OPT_CALLBACK_F('k', \"keep-empty\", &options, NULL,\n> --\n> 2.42.0\n\nLooks good to me; thanks.\n"}]}