path: root/builtin/add.c
diff options
authorRené Scharfe <>2018-08-02 19:18:14 (GMT)
committerJunio C Hamano <>2018-08-03 15:36:20 (GMT)
commit5f0df44cd79a953c287ccb598896ea7aaa2cc9e3 (patch)
treed438018d4b5dec908b60bd46913e36a8e6304ade /builtin/add.c
parentb8ade4c5766774207e05c8f92e262f8f6835bd3d (diff)
parse-options: automatically infer PARSE_OPT_LITERAL_ARGHELP
Parseopt wraps argument help strings in a pair of angular brackets by default, to tell users that they need to replace it with an actual value. This is useful in most cases, because most option arguments are indeed single values of a certain type. The option PARSE_OPT_LITERAL_ARGHELP needs to be used in option definitions with arguments that have multiple parts or are literal strings. Stop adding these angular brackets if special characters are present, as they indicate that we don't deal with a simple placeholder. This simplifies the code a bit and makes defining special options slightly easier. Remove the flag PARSE_OPT_LITERAL_ARGHELP in the cases where the new and more cautious handling suffices. Signed-off-by: Rene Scharfe <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin/add.c')
1 files changed, 2 insertions, 3 deletions
diff --git a/builtin/add.c b/builtin/add.c
index 110f2ae..8352bdf 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -306,9 +306,8 @@ static struct option builtin_add_options[] = {
OPT_BOOL( 0 , "refresh", &refresh_only, N_("don't add, only refresh the index")),
OPT_BOOL( 0 , "ignore-errors", &ignore_add_errors, N_("just skip files which cannot be added because of errors")),
OPT_BOOL( 0 , "ignore-missing", &ignore_missing, N_("check if - even missing - files are ignored in dry run")),
- { OPTION_STRING, 0, "chmod", &chmod_arg, "(+|-)x",
- N_("override the executable bit of the listed files"),
+ OPT_STRING(0, "chmod", &chmod_arg, "(+|-)x",
+ N_("override the executable bit of the listed files")),
OPT_HIDDEN_BOOL(0, "warn-embedded-repo", &warn_on_embedded_repo,
N_("warn when adding an embedded repository")),