Skip to content

Commit 8963bb0

Browse files
committed
Merge branch 'rs/parse-opt-lithelp'
The parse-options machinery learned to refrain from enclosing placeholder string inside a "<bra" and "ket>" pair automatically without PARSE_OPT_LITERAL_ARGHELP. Existing help text for option arguments that are not formatted correctly have been identified and fixed. * rs/parse-opt-lithelp: parse-options: automatically infer PARSE_OPT_LITERAL_ARGHELP shortlog: correct option help for -w send-pack: specify --force-with-lease argument help explicitly pack-objects: specify --index-version argument help explicitly difftool: remove angular brackets from argument help add, update-index: fix --chmod argument help push: use PARSE_OPT_LITERAL_ARGHELP instead of unbalanced brackets
2 parents 28dbabb + 5f0df44 commit 8963bb0

File tree

11 files changed

+19
-17
lines changed

11 files changed

+19
-17
lines changed

builtin/add.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ static struct option builtin_add_options[] = {
304304
OPT_BOOL( 0 , "refresh", &refresh_only, N_("don't add, only refresh the index")),
305305
OPT_BOOL( 0 , "ignore-errors", &ignore_add_errors, N_("just skip files which cannot be added because of errors")),
306306
OPT_BOOL( 0 , "ignore-missing", &ignore_missing, N_("check if - even missing - files are ignored in dry run")),
307-
OPT_STRING( 0 , "chmod", &chmod_arg, N_("(+/-)x"), N_("override the executable bit of the listed files")),
307+
OPT_STRING(0, "chmod", &chmod_arg, "(+|-)x",
308+
N_("override the executable bit of the listed files")),
308309
OPT_HIDDEN_BOOL(0, "warn-embedded-repo", &warn_on_embedded_repo,
309310
N_("warn when adding an embedded repository")),
310311
OPT_END(),

builtin/difftool.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,15 +703,15 @@ int cmd_difftool(int argc, const char **argv, const char *prefix)
703703
1, PARSE_OPT_NONEG | PARSE_OPT_HIDDEN),
704704
OPT_BOOL(0, "symlinks", &symlinks,
705705
N_("use symlinks in dir-diff mode")),
706-
OPT_STRING('t', "tool", &difftool_cmd, N_("<tool>"),
706+
OPT_STRING('t', "tool", &difftool_cmd, N_("tool"),
707707
N_("use the specified diff tool")),
708708
OPT_BOOL(0, "tool-help", &tool_help,
709709
N_("print a list of diff tools that may be used with "
710710
"`--tool`")),
711711
OPT_BOOL(0, "trust-exit-code", &trust_exit_code,
712712
N_("make 'git-difftool' exit when an invoked diff "
713713
"tool returns a non - zero exit code")),
714-
OPT_STRING('x', "extcmd", &extcmd, N_("<command>"),
714+
OPT_STRING('x', "extcmd", &extcmd, N_("command"),
715715
N_("specify a custom command for viewing diffs")),
716716
OPT_END()
717717
};

builtin/pack-objects.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3135,7 +3135,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
31353135
OPT_BOOL(0, "all-progress-implied",
31363136
&all_progress_implied,
31373137
N_("similar to --all-progress when progress meter is shown")),
3138-
{ OPTION_CALLBACK, 0, "index-version", NULL, N_("version[,offset]"),
3138+
{ OPTION_CALLBACK, 0, "index-version", NULL, N_("<version>[,<offset>]"),
31393139
N_("write the pack index file in the specified idx format version"),
31403140
0, option_parse_index_version },
31413141
OPT_MAGNITUDE(0, "max-pack-size", &pack_size_limit,

builtin/push.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,9 +558,9 @@ int cmd_push(int argc, const char **argv, const char *prefix)
558558
OPT_BIT( 0, "porcelain", &flags, N_("machine-readable output"), TRANSPORT_PUSH_PORCELAIN),
559559
OPT_BIT('f', "force", &flags, N_("force updates"), TRANSPORT_PUSH_FORCE),
560560
{ OPTION_CALLBACK,
561-
0, CAS_OPT_NAME, &cas, N_("refname>:<expect"),
561+
0, CAS_OPT_NAME, &cas, N_("<refname>:<expect>"),
562562
N_("require old value of ref to be at this value"),
563-
PARSE_OPT_OPTARG, parseopt_push_cas_option },
563+
PARSE_OPT_OPTARG | PARSE_OPT_LITERAL_ARGHELP, parseopt_push_cas_option },
564564
{ OPTION_CALLBACK, 0, "recurse-submodules", &recurse_submodules, "check|on-demand|no",
565565
N_("control recursive pushing of submodules"),
566566
PARSE_OPT_OPTARG, option_parse_recurse_submodules },

builtin/read-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
133133
N_("same as -m, but discard unmerged entries")),
134134
{ OPTION_STRING, 0, "prefix", &opts.prefix, N_("<subdirectory>/"),
135135
N_("read the tree into the index under <subdirectory>/"),
136-
PARSE_OPT_NONEG | PARSE_OPT_LITERAL_ARGHELP },
136+
PARSE_OPT_NONEG },
137137
OPT_BOOL('u', NULL, &opts.update,
138138
N_("update working tree with merge result")),
139139
{ OPTION_CALLBACK, 0, "exclude-per-directory", &opts,

builtin/send-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
178178
OPT_BOOL(0, "stdin", &from_stdin, N_("read refs from stdin")),
179179
OPT_BOOL(0, "helper-status", &helper_status, N_("print status from remote helper")),
180180
{ OPTION_CALLBACK,
181-
0, CAS_OPT_NAME, &cas, N_("refname>:<expect"),
181+
0, CAS_OPT_NAME, &cas, N_("<refname>:<expect>"),
182182
N_("require old value of ref to be at this value"),
183183
PARSE_OPT_OPTARG, parseopt_push_cas_option },
184184
OPT_END()

builtin/shortlog.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,9 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix)
268268
N_("Suppress commit descriptions, only provides commit count")),
269269
OPT_BOOL('e', "email", &log.email,
270270
N_("Show the email address of each author")),
271-
{ OPTION_CALLBACK, 'w', NULL, &log, N_("w[,i1[,i2]]"),
272-
N_("Linewrap output"), PARSE_OPT_OPTARG, &parse_wrap_args },
271+
{ OPTION_CALLBACK, 'w', NULL, &log, N_("<w>[,<i1>[,<i2>]]"),
272+
N_("Linewrap output"), PARSE_OPT_OPTARG,
273+
&parse_wrap_args },
273274
OPT_END(),
274275
};
275276

builtin/show-branch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
674674
{ OPTION_CALLBACK, 'g', "reflog", &reflog_base, N_("<n>[,<base>]"),
675675
N_("show <n> most recent ref-log entries starting at "
676676
"base"),
677-
PARSE_OPT_OPTARG | PARSE_OPT_LITERAL_ARGHELP,
677+
PARSE_OPT_OPTARG,
678678
parse_reflog_param },
679679
OPT_END()
680680
};

builtin/update-index.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -969,9 +969,9 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
969969
PARSE_OPT_NOARG | /* disallow --cacheinfo=<mode> form */
970970
PARSE_OPT_NONEG | PARSE_OPT_LITERAL_ARGHELP,
971971
(parse_opt_cb *) cacheinfo_callback},
972-
{OPTION_CALLBACK, 0, "chmod", &set_executable_bit, N_("(+/-)x"),
972+
{OPTION_CALLBACK, 0, "chmod", &set_executable_bit, "(+|-)x",
973973
N_("override the executable bit of the listed files"),
974-
PARSE_OPT_NONEG | PARSE_OPT_LITERAL_ARGHELP,
974+
PARSE_OPT_NONEG,
975975
chmod_callback},
976976
{OPTION_SET_INT, 0, "assume-unchanged", &mark_valid_only, NULL,
977977
N_("mark files as \"not changing\""),

builtin/write-tree.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ int cmd_write_tree(int argc, const char **argv, const char *unused_prefix)
2424
struct option write_tree_options[] = {
2525
OPT_BIT(0, "missing-ok", &flags, N_("allow missing objects"),
2626
WRITE_TREE_MISSING_OK),
27-
{ OPTION_STRING, 0, "prefix", &prefix, N_("<prefix>/"),
28-
N_("write tree object for a subdirectory <prefix>") ,
29-
PARSE_OPT_LITERAL_ARGHELP },
27+
OPT_STRING(0, "prefix", &prefix, N_("<prefix>/"),
28+
N_("write tree object for a subdirectory <prefix>")),
3029
{ OPTION_BIT, 0, "ignore-cache-tree", &flags, NULL,
3130
N_("only useful for debugging"),
3231
PARSE_OPT_HIDDEN | PARSE_OPT_NOARG, NULL,

0 commit comments

Comments
 (0)