Skip to content

Commit 8b5ebbe

Browse files
rscharfegitster
authored andcommitted
add, update-index: fix --chmod argument help
Don't translate the argument specification for --chmod; "+x" and "-x" are the literal strings that the commands accept. Separate alternatives using a pipe character instead of a slash, for consistency. Use the flag PARSE_OPT_LITERAL_ARGHELP to prevent parseopt from adding a pair of angular brackets around the argument help string, as that would wrongly indicate that users need to replace the literal strings with some kind of value. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent c67318e commit 8b5ebbe

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

builtin/add.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,9 @@ static struct option builtin_add_options[] = {
306306
OPT_BOOL( 0 , "refresh", &refresh_only, N_("don't add, only refresh the index")),
307307
OPT_BOOL( 0 , "ignore-errors", &ignore_add_errors, N_("just skip files which cannot be added because of errors")),
308308
OPT_BOOL( 0 , "ignore-missing", &ignore_missing, N_("check if - even missing - files are ignored in dry run")),
309-
OPT_STRING( 0 , "chmod", &chmod_arg, N_("(+/-)x"), N_("override the executable bit of the listed files")),
309+
{ OPTION_STRING, 0, "chmod", &chmod_arg, "(+|-)x",
310+
N_("override the executable bit of the listed files"),
311+
PARSE_OPT_LITERAL_ARGHELP },
310312
OPT_HIDDEN_BOOL(0, "warn-embedded-repo", &warn_on_embedded_repo,
311313
N_("warn when adding an embedded repository")),
312314
OPT_END(),

builtin/update-index.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
970970
PARSE_OPT_NOARG | /* disallow --cacheinfo=<mode> form */
971971
PARSE_OPT_NONEG | PARSE_OPT_LITERAL_ARGHELP,
972972
(parse_opt_cb *) cacheinfo_callback},
973-
{OPTION_CALLBACK, 0, "chmod", &set_executable_bit, N_("(+/-)x"),
973+
{OPTION_CALLBACK, 0, "chmod", &set_executable_bit, "(+|-)x",
974974
N_("override the executable bit of the listed files"),
975975
PARSE_OPT_NONEG | PARSE_OPT_LITERAL_ARGHELP,
976976
chmod_callback},

0 commit comments

Comments
 (0)