diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-10-28 21:26:54 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-10-28 21:26:54 +0300 |
commit | 7b9b634ca5e931941938c93bd233d9c6848fd7b2 (patch) | |
tree | aa12d9ca6aaa84c6ec7404c756e2f6f3a85a8293 /builtin | |
parent | 5af5e54106e20f65c913550c80aec3186b859e9b (diff) | |
parent | a0343f3002d229fd351ac4662ced580164657085 (diff) |
Merge branch 'ab/doc-synopsis-and-cmd-usage'
The short-help text shown by "git cmd -h" and the synopsis text
shown at the beginning of "git help cmd" have been made more
consistent.
* ab/doc-synopsis-and-cmd-usage: (34 commits)
tests: assert consistent whitespace in -h output
tests: start asserting that *.txt SYNOPSIS matches -h output
doc txt & -h consistency: make "worktree" consistent
worktree: define subcommand -h in terms of command -h
reflog doc: list real subcommands up-front
doc txt & -h consistency: make "commit" consistent
doc txt & -h consistency: make "diff-tree" consistent
doc txt & -h consistency: use "[<label>...]" for "zero or more"
doc txt & -h consistency: make "annotate" consistent
doc txt & -h consistency: make "stash" consistent
doc txt & -h consistency: add missing options
doc txt & -h consistency: use "git foo" form, not "git-foo"
doc txt & -h consistency: make "bundle" consistent
doc txt & -h consistency: make "read-tree" consistent
doc txt & -h consistency: make "rerere" consistent
doc txt & -h consistency: add missing options and labels
doc txt & -h consistency: make output order consistent
doc txt & -h consistency: add or fix optional "--" syntax
doc txt & -h consistency: fix mismatching labels
doc SYNOPSIS & -h: use "-" to separate words in labels, not "_"
...
Diffstat (limited to 'builtin')
46 files changed, 270 insertions, 128 deletions
diff --git a/builtin/blame.c b/builtin/blame.c index a9fe8cf7a6..71f925e456 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -30,6 +30,7 @@ #include "tag.h" static char blame_usage[] = N_("git blame [<options>] [<rev-opts>] [<rev>] [--] <file>"); +static char annotate_usage[] = N_("git annotate [<options>] [<rev-opts>] [<rev>] [--] <file>"); static const char *blame_opt_usage[] = { blame_usage, @@ -38,6 +39,13 @@ static const char *blame_opt_usage[] = { NULL }; +static const char *annotate_opt_usage[] = { + annotate_usage, + "", + N_("<rev-opts> are documented in git-rev-list(1)"), + NULL +}; + static int longest_file; static int longest_author; static int max_orig_digits; @@ -899,6 +907,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix) long anchor; const int hexsz = the_hash_algo->hexsz; long num_lines = 0; + const char *str_usage = cmd_is_annotate ? annotate_usage : blame_usage; + const char **opt_usage = cmd_is_annotate ? annotate_opt_usage : blame_opt_usage; setup_default_color_by_age(); git_config(git_blame_config, &output_option); @@ -914,7 +924,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix) parse_options_start(&ctx, argc, argv, prefix, options, PARSE_OPT_KEEP_DASHDASH | PARSE_OPT_KEEP_ARGV0); for (;;) { - switch (parse_options_step(&ctx, options, blame_opt_usage)) { + switch (parse_options_step(&ctx, options, opt_usage)) { case PARSE_OPT_NON_OPTION: case PARSE_OPT_UNKNOWN: break; @@ -934,7 +944,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix) ctx.argv[0] = "--children"; reverse = 1; } - parse_revision_opt(&revs, &ctx, options, blame_opt_usage); + parse_revision_opt(&revs, &ctx, options, opt_usage); } parse_done: revision_opts_finish(&revs); @@ -1040,7 +1050,7 @@ parse_done: switch (argc - dashdash_pos - 1) { case 2: /* (1b) */ if (argc != 4) - usage_with_options(blame_opt_usage, options); + usage_with_options(opt_usage, options); /* reorder for the new way: <rev> -- <path> */ argv[1] = argv[3]; argv[3] = argv[2]; @@ -1051,11 +1061,11 @@ parse_done: argv[argc] = NULL; break; default: - usage_with_options(blame_opt_usage, options); + usage_with_options(opt_usage, options); } } else { if (argc < 2) - usage_with_options(blame_opt_usage, options); + usage_with_options(opt_usage, options); if (argc == 3 && is_a_rev(argv[argc - 1])) { /* (2b) */ path = add_prefix(prefix, argv[1]); argv[1] = argv[2]; @@ -1113,7 +1123,7 @@ parse_done: nth_line_cb, &sb, lno, anchor, &bottom, &top, sb.path, the_repository->index)) - usage(blame_usage); + usage(str_usage); if ((!lno && (top || bottom)) || lno < bottom) die(Q_("file %s has only %lu line", "file %s has only %lu lines", diff --git a/builtin/bugreport.c b/builtin/bugreport.c index 530895be55..96052541cb 100644 --- a/builtin/bugreport.c +++ b/builtin/bugreport.c @@ -60,7 +60,8 @@ static void get_populated_hooks(struct strbuf *hook_info, int nongit) } static const char * const bugreport_usage[] = { - N_("git bugreport [-o|--output-directory <file>] [-s|--suffix <format>] [--diagnose[=<mode>]"), + N_("git bugreport [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n" + " [--diagnose[=<mode>]]"), NULL }; diff --git a/builtin/bundle.c b/builtin/bundle.c index e80efce3a4..544c78a5f3 100644 --- a/builtin/bundle.c +++ b/builtin/bundle.c @@ -11,32 +11,42 @@ * bundle supporting "fetch", "pull", and "ls-remote". */ -static const char * const builtin_bundle_usage[] = { - N_("git bundle create [<options>] <file> <git-rev-list args>"), - N_("git bundle verify [<options>] <file>"), - N_("git bundle list-heads <file> [<refname>...]"), - N_("git bundle unbundle <file> [<refname>...]"), - NULL +#define BUILTIN_BUNDLE_CREATE_USAGE \ + N_("git bundle create [-q | --quiet | --progress | --all-progress] [--all-progress-implied]\n" \ + " [--version=<version>] <file> <git-rev-list-args>") +#define BUILTIN_BUNDLE_VERIFY_USAGE \ + N_("git bundle verify [-q | --quiet] <file>") +#define BUILTIN_BUNDLE_LIST_HEADS_USAGE \ + N_("git bundle list-heads <file> [<refname>...]") +#define BUILTIN_BUNDLE_UNBUNDLE_USAGE \ + N_("git bundle unbundle [--progress] <file> [<refname>...]") + +static char const * const builtin_bundle_usage[] = { + BUILTIN_BUNDLE_CREATE_USAGE, + BUILTIN_BUNDLE_VERIFY_USAGE, + BUILTIN_BUNDLE_LIST_HEADS_USAGE, + BUILTIN_BUNDLE_UNBUNDLE_USAGE, + NULL, }; static const char * const builtin_bundle_create_usage[] = { - N_("git bundle create [<options>] <file> <git-rev-list args>"), - NULL + BUILTIN_BUNDLE_CREATE_USAGE, + NULL }; static const char * const builtin_bundle_verify_usage[] = { - N_("git bundle verify [<options>] <file>"), - NULL + BUILTIN_BUNDLE_VERIFY_USAGE, + NULL }; static const char * const builtin_bundle_list_heads_usage[] = { - N_("git bundle list-heads <file> [<refname>...]"), - NULL + BUILTIN_BUNDLE_LIST_HEADS_USAGE, + NULL }; static const char * const builtin_bundle_unbundle_usage[] = { - N_("git bundle unbundle <file> [<refname>...]"), - NULL + BUILTIN_BUNDLE_UNBUNDLE_USAGE, + NULL }; static int parse_options_cmd_bundle(int argc, diff --git a/builtin/cat-file.c b/builtin/cat-file.c index 989eee0bb4..fa7bd89169 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -893,7 +893,7 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix) N_("git cat-file (-t | -s) [--allow-unknown-type] <object>"), N_("git cat-file (--batch | --batch-check | --batch-command) [--batch-all-objects]\n" " [--buffer] [--follow-symlinks] [--unordered]\n" - " [--textconv | --filters]"), + " [--textconv | --filters] [-z]"), N_("git cat-file (--textconv | --filters)\n" " [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"), NULL diff --git a/builtin/clean.c b/builtin/clean.c index 5466636e66..40ff2c578d 100644 --- a/builtin/clean.c +++ b/builtin/clean.c @@ -26,7 +26,7 @@ static struct string_list del_list = STRING_LIST_INIT_DUP; static unsigned int colopts; static const char *const builtin_clean_usage[] = { - N_("git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <paths>..."), + N_("git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] [<pathspec>...]"), NULL }; diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c index 51557fe786..e8f77f535f 100644 --- a/builtin/commit-graph.c +++ b/builtin/commit-graph.c @@ -10,13 +10,13 @@ #include "tag.h" #define BUILTIN_COMMIT_GRAPH_VERIFY_USAGE \ - N_("git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress]") + N_("git commit-graph verify [--object-dir <dir>] [--shallow] [--[no-]progress]") #define BUILTIN_COMMIT_GRAPH_WRITE_USAGE \ - N_("git commit-graph write [--object-dir <objdir>] [--append] " \ - "[--split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] " \ - "[--changed-paths] [--[no-]max-new-filters <n>] [--[no-]progress] " \ - "<split options>") + N_("git commit-graph write [--object-dir <dir>] [--append]\n" \ + " [--split[=<strategy>]] [--reachable | --stdin-packs | --stdin-commits]\n" \ + " [--changed-paths] [--[no-]max-new-filters <n>] [--[no-]progress]\n" \ + " <split options>") static const char * builtin_commit_graph_verify_usage[] = { BUILTIN_COMMIT_GRAPH_VERIFY_USAGE, diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c index 63ea322933..cc8d584be2 100644 --- a/builtin/commit-tree.c +++ b/builtin/commit-tree.c @@ -15,8 +15,9 @@ #include "parse-options.h" static const char * const commit_tree_usage[] = { - N_("git commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...] " - "[(-F <file>)...] <tree>"), + N_("git commit-tree <tree> [(-p <parent>)...]"), + N_("git commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...]\n" + " [(-F <file>)...] <tree>"), NULL }; diff --git a/builtin/commit.c b/builtin/commit.c index d9de4ef008..e22bdf23f5 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -40,12 +40,19 @@ #include "pretty.h" static const char * const builtin_commit_usage[] = { - N_("git commit [<options>] [--] <pathspec>..."), + N_("git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend]\n" + " [--dry-run] [(-c | -C | --squash) <commit> | --fixup [(amend|reword):]<commit>)]\n" + " [-F <file> | -m <msg>] [--reset-author] [--allow-empty]\n" + " [--allow-empty-message] [--no-verify] [-e] [--author=<author>]\n" + " [--date=<date>] [--cleanup=<mode>] [--[no-]status]\n" + " [-i | -o] [--pathspec-from-file=<file> [--pathspec-file-nul]]\n" + " [(--trailer <token>[(=|:)<value>])...] [-S[<keyid>]]\n" + " [--] [<pathspec>...]"), NULL }; static const char * const builtin_status_usage[] = { - N_("git status [<options>] [--] <pathspec>..."), + N_("git status [<options>] [--] [<pathspec>...]"), NULL }; diff --git a/builtin/credential-cache--daemon.c b/builtin/credential-cache--daemon.c index 4c6c89ab0d..f3c89831d4 100644 --- a/builtin/credential-cache--daemon.c +++ b/builtin/credential-cache--daemon.c @@ -267,7 +267,7 @@ int cmd_credential_cache_daemon(int argc, const char **argv, const char *prefix) const char *socket_path; int ignore_sighup = 0; static const char *usage[] = { - "git-credential-cache--daemon [opts] <socket_path>", + "git credential-cache--daemon [--debug] <socket-path>", NULL }; int debug = 0; @@ -305,7 +305,7 @@ int cmd_credential_cache_daemon(int argc, const char **argv, const char *prefix) int cmd_credential_cache_daemon(int argc, const char **argv, const char *prefix) { const char * const usage[] = { - "git credential-cache--daemon [options] <action>", + "git credential-cache--daemon [--debug] <socket-path>", "", "credential-cache--daemon is disabled in this build of Git", NULL diff --git a/builtin/describe.c b/builtin/describe.c index e17c4b4c69..23e3f05fb1 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -23,8 +23,9 @@ define_commit_slab(commit_names, struct commit_name *); static const char * const describe_usage[] = { - N_("git describe [<options>] [<commit-ish>...]"), - N_("git describe [<options>] --dirty"), + N_("git describe [--all] [--tags] [--contains] [--abbrev=<n>] [<commit-ish>...]"), + N_("git describe [--all] [--tags] [--contains] [--abbrev=<n>] --dirty[=<mark>]"), + N_("git describe <blob>"), NULL }; diff --git a/builtin/diagnose.c b/builtin/diagnose.c index 576e0e8e38..d52015c67a 100644 --- a/builtin/diagnose.c +++ b/builtin/diagnose.c @@ -3,7 +3,8 @@ #include "diagnose.h" static const char * const diagnose_usage[] = { - N_("git diagnose [-o|--output-directory <path>] [-s|--suffix <format>] [--mode=<mode>]"), + N_("git diagnose [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n" + " [--mode=<mode>]"), NULL }; diff --git a/builtin/diff-files.c b/builtin/diff-files.c index 92cf6e1e92..096ea2fedb 100644 --- a/builtin/diff-files.c +++ b/builtin/diff-files.c @@ -15,6 +15,7 @@ static const char diff_files_usage[] = "git diff-files [-q] [-0 | -1 | -2 | -3 | -c | --cc] [<common-diff-options>] [<path>...]" +"\n" COMMON_DIFF_OPTIONS_HELP; int cmd_diff_files(int argc, const char **argv, const char *prefix) diff --git a/builtin/diff-index.c b/builtin/diff-index.c index 7d158af6b6..aea139b9d8 100644 --- a/builtin/diff-index.c +++ b/builtin/diff-index.c @@ -9,8 +9,9 @@ #include "submodule.h" static const char diff_cache_usage[] = -"git diff-index [-m] [--cached] " +"git diff-index [-m] [--cached] [--merge-base] " "[<common-diff-options>] <tree-ish> [<path>...]" +"\n" COMMON_DIFF_OPTIONS_HELP; int cmd_diff_index(int argc, const char **argv, const char *prefix) diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c index 116097a404..85e8c81e59 100644 --- a/builtin/diff-tree.c +++ b/builtin/diff-tree.c @@ -83,8 +83,10 @@ static int diff_tree_stdin(char *line) } static const char diff_tree_usage[] = -"git diff-tree [--stdin] [-m] [-c | --cc] [-s] [-v] [--pretty] [-t] [-r] [--root] " -"[<common-diff-options>] <tree-ish> [<tree-ish>] [<path>...]\n" +"git diff-tree [--stdin] [-m] [-s] [-v] [--no-commit-id] [--pretty]\n" +" [-t] [-r] [-c | --cc] [--combined-all-paths] [--root] [--merge-base]\n" +" [<common-diff-options>] <tree-ish> [<tree-ish>] [<path>...]\n" +"\n" " -r diff recursively\n" " -c show combined diff for merge commits\n" " --cc show combined diff for merge commits removing uninteresting hunks\n" diff --git a/builtin/diff.c b/builtin/diff.c index 0e49919735..854d2c5a5c 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -30,7 +30,8 @@ static const char builtin_diff_usage[] = " or: git diff [<options>] [--merge-base] <commit> [<commit>...] <commit> [--] [<path>...]\n" " or: git diff [<options>] <commit>...<commit> [--] [<path>...]\n" " or: git diff [<options>] <blob> <blob>\n" -" or: git diff [<options>] --no-index [--] <path> <path>\n" +" or: git diff [<options>] --no-index [--] <path> <path>" +"\n" COMMON_DIFF_OPTIONS_HELP; static const char *blob_path(struct object_array_entry *entry) diff --git a/builtin/for-each-repo.c b/builtin/for-each-repo.c index fd86e5a861..d45d873f57 100644 --- a/builtin/for-each-repo.c +++ b/builtin/for-each-repo.c @@ -6,7 +6,7 @@ #include "string-list.h" static const char * const for_each_repo_usage[] = { - N_("git for-each-repo --config=<config> <command-args>"), + N_("git for-each-repo --config=<config> [--] <arguments>"), NULL }; diff --git a/builtin/fsck.c b/builtin/fsck.c index 41acbc229e..7436e1a68e 100644 --- a/builtin/fsck.c +++ b/builtin/fsck.c @@ -820,7 +820,10 @@ static int mark_packed_for_connectivity(const struct object_id *oid, } static char const * const fsck_usage[] = { - N_("git fsck [<options>] [<object>...]"), + N_("git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]\n" + " [--[no-]full] [--strict] [--verbose] [--lost-found]\n" + " [--[no-]dangling] [--[no-]progress] [--connectivity-only]\n" + " [--[no-]name-objects] [<object>...]"), NULL }; diff --git a/builtin/hash-object.c b/builtin/hash-object.c index fbae878c2b..b506381502 100644 --- a/builtin/hash-object.c +++ b/builtin/hash-object.c @@ -80,8 +80,9 @@ static void hash_stdin_paths(const char *type, int no_filters, unsigned flags, int cmd_hash_object(int argc, const char **argv, const char *prefix) { static const char * const hash_object_usage[] = { - N_("git hash-object [-t <type>] [-w] [--path=<file> | --no-filters] [--stdin] [--] <file>..."), - "git hash-object --stdin-paths", + N_("git hash-object [-t <type>] [-w] [--path=<file> | --no-filters]\n" + " [--stdin [--literally]] [--] <file>..."), + N_("git hash-object [-t <type>] [-w] --stdin-paths [--no-filters]"), NULL }; const char *type = blob_type; diff --git a/builtin/help.c b/builtin/help.c index 6f2796f211..53f2812dfb 100644 --- a/builtin/help.c +++ b/builtin/help.c @@ -88,7 +88,7 @@ static struct option builtin_help_options[] = { }; static const char * const builtin_help_usage[] = { - "git help [-a|--all] [--[no-]verbose]] [--[no-]external-commands] [--[no-]aliases]", + "git help [-a|--all] [--[no-]verbose] [--[no-]external-commands] [--[no-]aliases]", N_("git help [[-i|--info] [-m|--man] [-w|--web]] [<command>|<doc>]"), "git help [-g|--guides]", "git help [-c|--config]", diff --git a/builtin/init-db.c b/builtin/init-db.c index 546f9c595e..dcaaf102ea 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -515,7 +515,10 @@ static int shared_callback(const struct option *opt, const char *arg, int unset) } static const char *const init_db_usage[] = { - N_("git init [-q | --quiet] [--bare] [--template=<template-directory>] [--shared[=<permissions>]] [<directory>]"), + N_("git init [-q | --quiet] [--bare] [--template=<template-directory>]\n" + " [--separate-git-dir <git-dir>] [--object-format=<format>]\n" + " [-b <branch-name> | --initial-branch=<branch-name>]\n" + " [--shared[=<permissions>]] [<directory>]"), NULL }; diff --git a/builtin/interpret-trailers.c b/builtin/interpret-trailers.c index 84748eafc0..e58627c72a 100644 --- a/builtin/interpret-trailers.c +++ b/builtin/interpret-trailers.c @@ -13,7 +13,9 @@ #include "config.h" static const char * const git_interpret_trailers_usage[] = { - N_("git interpret-trailers [--in-place] [--trim-empty] [(--trailer <token>[(=|:)<value>])...] [<file>...]"), + N_("git interpret-trailers [--in-place] [--trim-empty]\n" + " [(--trailer <token>[(=|:)<value>])...]\n" + " [--parse] [<file>...]"), NULL }; diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c index df44e5cc0d..5d5ac03871 100644 --- a/builtin/ls-remote.c +++ b/builtin/ls-remote.c @@ -7,7 +7,7 @@ static const char * const ls_remote_usage[] = { N_("git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n" - " [-q | --quiet] [--exit-code] [--get-url]\n" + " [-q | --quiet] [--exit-code] [--get-url] [--sort=<key>]\n" " [--symref] [<repository> [<refs>...]]"), NULL }; diff --git a/builtin/merge-base.c b/builtin/merge-base.c index a11f8c6e4b..6f3941f2a4 100644 --- a/builtin/merge-base.c +++ b/builtin/merge-base.c @@ -31,8 +31,8 @@ static int show_merge_base(struct commit **rev, int rev_nr, int show_all) static const char * const merge_base_usage[] = { N_("git merge-base [-a | --all] <commit> <commit>..."), N_("git merge-base [-a | --all] --octopus <commit>..."), - N_("git merge-base --independent <commit>..."), N_("git merge-base --is-ancestor <commit> <commit>"), + N_("git merge-base --independent <commit>..."), N_("git merge-base --fork-point <ref> [<commit>]"), NULL }; diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 3658c05caf..573d0b20b7 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -180,8 +180,8 @@ static inline void oe_set_delta_size(struct packing_data *pack, #define SET_DELTA_SIBLING(obj, val) oe_set_delta_sibling(&to_pack, obj, val) static const char *pack_usage[] = { - N_("git pack-objects --stdout [<options>...] [< <ref-list> | < <object-list>]"), - N_("git pack-objects [<options>...] <base-name> [< <ref-list> | < <object-list>]"), + N_("git pack-objects --stdout [<options>] [< <ref-list> | < <object-list>]"), + N_("git pack-objects [<options>] <base-name> [< <ref-list> | < <object-list>]"), NULL }; diff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c index ed9b9013a5..ecd49ca268 100644 --- a/builtin/pack-redundant.c +++ b/builtin/pack-redundant.c @@ -14,7 +14,7 @@ #define BLKSIZE 512 static const char pack_redundant_usage[] = -"git pack-redundant [--verbose] [--alt-odb] (--all | <filename.pack>...)"; +"git pack-redundant [--verbose] [--alt-odb] (--all | <pack-filename>...)"; static int load_all_packs, verbose, alt_odb; diff --git a/builtin/pack-refs.c b/builtin/pack-refs.c index cfbd5c36c7..27c2ca06ac 100644 --- a/builtin/pack-refs.c +++ b/builtin/pack-refs.c @@ -5,7 +5,7 @@ #include "repository.h" static char const * const pack_refs_usage[] = { - N_("git pack-refs [<options>]"), + N_("git pack-refs [--all] [--no-prune]"), NULL }; diff --git a/builtin/read-tree.c b/builtin/read-tree.c index 9f1f33e954..f4cbe460b9 100644 --- a/builtin/read-tree.c +++ b/builtin/read-tree.c @@ -38,7 +38,9 @@ static int list_tree(struct object_id *oid) } static const char * const read_tree_usage[] = { - N_("git read-tree [(-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>) [-u | -i]] [--no-sparse-checkout] [--index-output=<file>] (--empty | <tree-ish1> [<tree-ish2> [<tree-ish3>]])"), + N_("git read-tree [(-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>)\n" + " [-u | -i]] [--index-output=<file>] [--no-sparse-checkout]\n" + " (--empty | <tree-ish1> [<tree-ish2> [<tree-ish3>]])"), NULL }; diff --git a/builtin/rerere.c b/builtin/rerere.c index 83d7a778e3..8b7392d5b4 100644 --- a/builtin/rerere.c +++ b/builtin/rerere.c @@ -10,7 +10,7 @@ #include "pathspec.h" static const char * const rerere_usage[] = { - N_("git rerere [clear | forget <path>... | status | remaining | diff | gc]"), + N_("git rerere [clear | forget <pathspec>... | diff | status | remaining | gc]"), NULL, }; diff --git a/builtin/rev-list.c b/builtin/rev-list.c index fba6f5d51f..3acd93f71e 100644 --- a/builtin/rev-list.c +++ b/builtin/rev-list.c @@ -20,7 +20,8 @@ #include "packfile.h" static const char rev_list_usage[] = -"git rev-list [<options>] <commit-id>... [-- <path>...]\n" +"git rev-list [<options>] <commit>... [--] [<path>...]\n" +"\n" " limiting output:\n" " --max-count=<n>\n" " --max-age=<epoch>\n" diff --git a/builtin/revert.c b/builtin/revert.c index ee2a0807f0..ee32c714a7 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -21,14 +21,15 @@ */ static const char * const revert_usage[] = { - N_("git revert [<options>] <commit-ish>..."), - N_("git revert <subcommand>"), + N_("git revert [--[no-]edit] [-n] [-m parent-number] [-s] [-S[<keyid>]] <commit>..."), + N_("git revert (--continue | --skip | --abort | --quit)"), NULL }; static const char * const cherry_pick_usage[] = { - N_("git cherry-pick [<options>] <commit-ish>..."), - N_("git cherry-pick <subcommand>"), + N_("git cherry-pick [--edit] [-n] [-m <parent-number>] [-s] [-x] [--ff]\n" + " [-S[<keyid>]] <commit>..."), + N_("git cherry-pick (--continue | --skip | --abort | --quit)"), NULL }; diff --git a/builtin/rm.c b/builtin/rm.c index b6ba859fe4..f0d025a4e2 100644 --- a/builtin/rm.c +++ b/builtin/rm.c @@ -17,7 +17,9 @@ #include "pathspec.h" static const char * const builtin_rm_usage[] = { - N_("git rm [<options>] [--] <file>..."), + N_("git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch]\n" + " [--quiet] [--pathspec-from-file=<file> [--pathspec-file-nul]]\n" + " [--] [<pathspec>...]"), NULL }; diff --git a/builtin/send-pack.c b/builtin/send-pack.c index 64962be016..4c5d125fa0 100644 --- a/builtin/send-pack.c +++ b/builtin/send-pack.c @@ -20,6 +20,7 @@ static const char * const send_pack_usage[] = { N_("git send-pack [--mirror] [--dry-run] [--force]\n" " [--receive-pack=<git-receive-pack>]\n" " [--verbose] [--thin] [--atomic]\n" + " [--[no-]signed | --signed=(true|false|if-asked)]\n" " [<host>:]<directory> (--all | <ref>...)"), NULL, }; diff --git a/builtin/show-branch.c b/builtin/show-branch.c index d3f5715e3e..c013abaf94 100644 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@ -14,7 +14,8 @@ static const char* show_branch_usage[] = { N_("git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n" " [--current] [--color[=<when>] | --no-color] [--sparse]\n" " [--more=<n> | --list | --independent | --merge-base]\n" - " [--no-name | --sha1-name] [--topics] [(<rev> | <glob>)...]"), + " [--no-name | --sha1-name] [--topics]\n" + " [(<rev> | <glob>)...]"), N_("git show-branch (-g | --reflog)[=<n>[,<base>]] [--list] [<ref>]"), NULL }; diff --git a/builtin/show-ref.c b/builtin/show-ref.c index 4856906108..3af6a53ee9 100644 --- a/builtin/show-ref.c +++ b/builtin/show-ref.c @@ -9,7 +9,9 @@ #include "parse-options.h" static const char * const show_ref_usage[] = { - N_("git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference] [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags] [--heads] [--] [<pattern>...]"), + N_("git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n" + " [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n" + " [--heads] [--] [<pattern>...]"), N_("git show-ref --exclude-existing[=<pattern>]"), NULL }; diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c index 287716db68..58a22503f0 100644 --- a/builtin/sparse-checkout.c +++ b/builtin/sparse-checkout.c @@ -20,7 +20,7 @@ static const char *empty_base = ""; static char const * const builtin_sparse_checkout_usage[] = { - N_("git sparse-checkout (init|list|set|add|reapply|disable) <options>"), + N_("git sparse-checkout (init | list | set | add | reapply | disable) [<options>]"), NULL }; diff --git a/builtin/stash.c b/builtin/stash.c index 2274aae255..bb5485b409 100644 --- a/builtin/stash.c +++ b/builtin/stash.c @@ -21,72 +21,95 @@ #define INCLUDE_ALL_FILES 2 +#define BUILTIN_STASH_LIST_USAGE \ + N_("git stash list [<log-options>]") +#define BUILTIN_STASH_SHOW_USAGE \ + N_("git stash show [-u | --include-untracked | --only-untracked] [<diff-options>] [<stash>]") +#define BUILTIN_STASH_DROP_USAGE \ + N_("git stash drop [-q | --quiet] [<stash>]") +#define BUILTIN_STASH_POP_USAGE \ + N_("git stash pop [--index] [-q | --quiet] [<stash>]") +#define BUILTIN_STASH_APPLY_USAGE \ + N_("git stash apply [--index] [-q | --quiet] [<stash>]") +#define BUILTIN_STASH_BRANCH_USAGE \ + N_("git stash branch <branchname> [<stash>]") +#define BUILTIN_STASH_STORE_USAGE \ + N_("git stash store [(-m | --message) <message>] [-q | --quiet] <commit>") +#define BUILTIN_STASH_PUSH_USAGE \ + N_("git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]\n" \ + " [-u | --include-untracked] [-a | --all] [(-m | --message) <message>]\n" \ + " [--pathspec-from-file=<file> [--pathspec-file-nul]]\n" \ + " [--] [<pathspec>...]]") +#define BUILTIN_STASH_SAVE_USAGE \ + N_("git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]\n" \ + " [-u | --include-untracked] [-a | --all] [<message>]") +#define BUILTIN_STASH_CREATE_USAGE \ + N_("git stash create [<message>]") +#define BUILTIN_STASH_CLEAR_USAGE \ + "git stash clear" + static const char * const git_stash_usage[] = { - N_("git stash list [<options>]"), - N_("git stash show [<options>] [<stash>]"), - N_("git stash drop [-q|--quiet] [<stash>]"), - N_("git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]"), - N_("git stash branch <branchname> [<stash>]"), - "git stash clear", - N_("git stash [push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--quiet]\n" - " [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n" - " [--pathspec-from-file=<file> [--pathspec-file-nul]]\n" - " [--] [<pathspec>...]]"), - N_("git stash save [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--quiet]\n" - " [-u|--include-untracked] [-a|--all] [<message>]"), + BUILTIN_STASH_LIST_USAGE, + BUILTIN_STASH_SHOW_USAGE, + BUILTIN_STASH_DROP_USAGE, + BUILTIN_STASH_POP_USAGE, + BUILTIN_STASH_APPLY_USAGE, + BUILTIN_STASH_BRANCH_USAGE, + BUILTIN_STASH_PUSH_USAGE, + BUILTIN_STASH_SAVE_USAGE, + BUILTIN_STASH_CLEAR_USAGE, + BUILTIN_STASH_CREATE_USAGE, + BUILTIN_STASH_STORE_USAGE, NULL }; static const char * const git_stash_list_usage[] = { - N_("git stash list [<options>]"), + BUILTIN_STASH_LIST_USAGE, NULL }; static const char * const git_stash_show_usage[] = { - N_("git stash show [<options>] [<stash>]"), + BUILTIN_STASH_SHOW_USAGE, NULL }; static const char * const git_stash_drop_usage[] = { - N_("git stash drop [-q|--quiet] [<stash>]"), + BUILTIN_STASH_DROP_USAGE, NULL }; static const char * const git_stash_pop_usage[] = { - N_("git stash pop [--index] [-q|--quiet] [<stash>]"), + BUILTIN_STASH_POP_USAGE, NULL }; static const char * const git_stash_apply_usage[] = { - N_("git stash apply [--index] [-q|--quiet] [<stash>]"), + BUILTIN_STASH_APPLY_USAGE, NULL }; static const char * const git_stash_branch_usage[] = { - N_("git stash branch <branchname> [<stash>]"), + BUILTIN_STASH_BRANCH_USAGE, NULL }; static const char * const git_stash_clear_usage[] = { - "git stash clear", + BUILTIN_STASH_CLEAR_USAGE, NULL }; static const char * const git_stash_store_usage[] = { - N_("git stash store [-m|--message <message>] [-q|--quiet] <commit>"), + BUILTIN_STASH_STORE_USAGE, NULL }; static const char * const git_stash_push_usage[] = { - N_("git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n" - " [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n" - " [--] [<pathspec>...]]"), + BUILTIN_STASH_PUSH_USAGE, NULL }; static const char * const git_stash_save_usage[] = { - N_("git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n" - " [-u|--include-untracked] [-a|--all] [<message>]"), + BUILTIN_STASH_SAVE_USAGE, NULL }; diff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c index 590ed17dd3..e00768a8b7 100644 --- a/builtin/symbolic-ref.c +++ b/builtin/symbolic-ref.c @@ -5,8 +5,9 @@ #include "parse-options.h" static const char * const git_symbolic_ref_usage[] = { - N_("git symbolic-ref [<options>] <name> [<ref>]"), - N_("git symbolic-ref -d [-q] [--no-recurse] <name>"), + N_("git symbolic-ref [-m <reason>] <name> <ref>"), + N_("git symbolic-ref [-q] [--short] [--no-recurse] <name>"), + N_("git symbolic-ref --delete [-q] <name>"), NULL }; diff --git a/builtin/tag.c b/builtin/tag.c index 75dece0e4f..d428c45dc8 100644 --- a/builtin/tag.c +++ b/builtin/tag.c @@ -23,11 +23,13 @@ #include "date.h" static const char * const git_tag_usage[] = { - N_("git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>]\n" - " <tagname> [<head>]"), + N_("git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] [-e]\n" + " <tagname> [<commit> | <object>]"), N_("git tag -d <tagname>..."), - N_("git tag -l [-n[<num>]] [--contains <commit>] [--no-contains <commit>] [--points-at <object>]\n" - " [--format=<format>] [--merged <commit>] [--no-merged <commit>] [<pattern>...]"), + N_("git tag [-n[<num>]] -l [--contains <commit>] [--no-contains <commit>]\n" + " [--points-at <object>] [--column[=<options>] | --no-column]\n" + " [--create-reflog] [--sort=<key>] [--format=<format>]\n" + " [--merged <commit>] [--no-merged <commit>] [<pattern>...]"), N_("git tag -v [--format=<format>] <tagname>..."), NULL }; diff --git a/builtin/unpack-file.c b/builtin/unpack-file.c index 58652229f2..9e8119dd35 100644 --- a/builtin/unpack-file.c +++ b/builtin/unpack-file.c @@ -27,7 +27,7 @@ int cmd_unpack_file(int argc, const char **argv, const char *prefix) struct object_id oid; if (argc != 2 || !strcmp(argv[1], "-h")) - usage("git unpack-file <sha1>"); + usage("git unpack-file <blob>"); if (get_oid(argv[1], &oid)) die("Not a valid object name %s", argv[1]); diff --git a/builtin/update-server-info.c b/builtin/update-server-info.c index 880fffec58..d2239c9ef4 100644 --- a/builtin/update-server-info.c +++ b/builtin/update-server-info.c @@ -4,7 +4,7 @@ #include "parse-options.h" static const char * const update_server_info_usage[] = { - "git update-server-info [--force]", + "git update-server-info [-f | --force]", NULL }; diff --git a/builtin/upload-archive.c b/builtin/upload-archive.c index 98d028dae6..945ee2b412 100644 --- a/builtin/upload-archive.c +++ b/builtin/upload-archive.c @@ -10,7 +10,7 @@ #include "strvec.h" static const char upload_archive_usage[] = - "git upload-archive <repo>"; + "git upload-archive <repository>"; static const char deadchild[] = "git upload-archive: archiver died with error"; diff --git a/builtin/upload-pack.c b/builtin/upload-pack.c index 125af53885..25b69da2bf 100644 --- a/builtin/upload-pack.c +++ b/builtin/upload-pack.c @@ -8,7 +8,8 @@ #include "serve.h" static const char * const upload_pack_usage[] = { - N_("git upload-pack [<options>] <dir>"), + N_("git-upload-pack [--[no-]strict] [--timeout=<n>] [--stateless-rpc]\n" + " [--advertise-refs] <directory>"), NULL }; diff --git a/builtin/verify-commit.c b/builtin/verify-commit.c index 40c69a0bed..3ebad32b0f 100644 --- a/builtin/verify-commit.c +++ b/builtin/verify-commit.c @@ -16,7 +16,7 @@ #include "gpg-interface.h" static const char * const verify_commit_usage[] = { - N_("git verify-commit [-v | --verbose] <commit>..."), + N_("git verify-commit [-v | --verbose] [--raw] <commit>..."), NULL }; diff --git a/builtin/verify-pack.c b/builtin/verify-pack.c index 05c5213594..27d6f75fd8 100644 --- a/builtin/verify-pack.c +++ b/builtin/verify-pack.c @@ -56,7 +56,7 @@ static int verify_one_pack(const char *path, unsigned int flags, const char *has } static const char * const verify_pack_usage[] = { - N_("git verify-pack [-v | --verbose] [-s | --stat-only] <pack>..."), + N_("git verify-pack [-v | --verbose] [-s | --stat-only] [--] <pack>.idx..."), NULL }; diff --git a/builtin/verify-tag.c b/builtin/verify-tag.c index f45136a06b..217566952d 100644 --- a/builtin/verify-tag.c +++ b/builtin/verify-tag.c @@ -15,7 +15,7 @@ #include "ref-filter.h" static const char * const verify_tag_usage[] = { - N_("git verify-tag [-v | --verbose] [--format=<format>] <tag>..."), + N_("git verify-tag [-v | --verbose] [--format=<format>] [--raw] <tag>..."), NULL }; diff --git a/builtin/worktree.c b/builtin/worktree.c index c6710b2552..4a24d53be1 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -15,15 +15,73 @@ #include "worktree.h" #include "quote.h" -static const char * const worktree_usage[] = { - N_("git worktree add [<options>] <path> [<commit-ish>]"), - N_("git worktree list [<options>]"), - N_("git worktree lock [<options>] <path>"), - N_("git worktree move <worktree> <new-path>"), - N_("git worktree prune [<options>]"), - N_("git worktree remove [<options>] <worktree>"), - N_("git worktree repair [<path>...]"), - N_("git worktree unlock <path>"), +#define BUILTIN_WORKTREE_ADD_USAGE \ + N_("git worktree add [-f] [--detach] [--checkout] [--lock [--reason <string>]]\n" \ + " [-b <new-branch>] <path> [<commit-ish>]") +#define BUILTIN_WORKTREE_LIST_USAGE \ + N_("git worktree list [-v | --porcelain [-z]]") +#define BUILTIN_WORKTREE_LOCK_USAGE \ + N_("git worktree lock [--reason <string>] <worktree>") +#define BUILTIN_WORKTREE_MOVE_USAGE \ + N_("git worktree move <worktree> <new-path>") +#define BUILTIN_WORKTREE_PRUNE_USAGE \ + N_("git worktree prune [-n] [-v] [--expire <expire>]") +#define BUILTIN_WORKTREE_REMOVE_USAGE \ + N_("git worktree remove [-f] <worktree>") +#define BUILTIN_WORKTREE_REPAIR_USAGE \ + N_("git worktree repair [<path>...]") +#define BUILTIN_WORKTREE_UNLOCK_USAGE \ + N_("git worktree unlock <worktree>") + +static const char * const git_worktree_usage[] = { + BUILTIN_WORKTREE_ADD_USAGE, + BUILTIN_WORKTREE_LIST_USAGE, + BUILTIN_WORKTREE_LOCK_USAGE, + BUILTIN_WORKTREE_MOVE_USAGE, + BUILTIN_WORKTREE_PRUNE_USAGE, + BUILTIN_WORKTREE_REMOVE_USAGE, + BUILTIN_WORKTREE_REPAIR_USAGE, + BUILTIN_WORKTREE_UNLOCK_USAGE, + NULL +}; + +static const char * const git_worktree_add_usage[] = { + BUILTIN_WORKTREE_ADD_USAGE, + NULL, +}; + +static const char * const git_worktree_list_usage[] = { + BUILTIN_WORKTREE_LIST_USAGE, + NULL +}; + +static const char * const git_worktree_lock_usage[] = { + BUILTIN_WORKTREE_LOCK_USAGE, + NULL +}; + +static const char * const git_worktree_move_usage[] = { + BUILTIN_WORKTREE_MOVE_USAGE, + NULL +}; + +static const char * const git_worktree_prune_usage[] = { + BUILTIN_WORKTREE_PRUNE_USAGE, + NULL +}; + +static const char * const git_worktree_remove_usage[] = { + BUILTIN_WORKTREE_REMOVE_USAGE, + NULL +}; + +static const char * const git_worktree_repair_usage[] = { + BUILTIN_WORKTREE_REPAIR_USAGE, + NULL +}; + +static const char * const git_worktree_unlock_usage[] = { + BUILTIN_WORKTREE_UNLOCK_USAGE, NULL }; @@ -153,9 +211,10 @@ static int prune(int ac, const char **av, const char *prefix) }; expire = TIME_MAX; - ac = parse_options(ac, av, prefix, options, worktree_usage, 0); + ac = parse_options(ac, av, prefix, options, git_worktree_prune_usage, + 0); if (ac) - usage_with_options(worktree_usage, options); + usage_with_options(git_worktree_prune_usage, options); prune_worktrees(); return 0; } @@ -573,7 +632,7 @@ static int add(int ac, const char **av, const char *prefix) memset(&opts, 0, sizeof(opts)); opts.checkout = 1; - ac = parse_options(ac, av, prefix, options, worktree_usage, 0); + ac = parse_options(ac, av, prefix, options, git_worktree_add_usage, 0); if (!!opts.detach + !!new_branch + !!new_branch_force > 1) die(_("options '%s', '%s', and '%s' cannot be used together"), "-b", "-B", "--detach"); if (lock_reason && !keep_locked) @@ -584,7 +643,7 @@ static int add(int ac, const char **av, const char *prefix) opts.keep_locked = _("added with --lock"); if (ac < 1 || ac > 2) - usage_with_options(worktree_usage, options); + usage_with_options(git_worktree_add_usage, options); path = prefix_filename(prefix, av[0]); branch = ac < 2 ? "HEAD" : av[1]; @@ -772,9 +831,9 @@ static int list(int ac, const char **av, const char *prefix) }; expire = TIME_MAX; - ac = parse_options(ac, av, prefix, options, worktree_usage, 0); + ac = parse_options(ac, av, prefix, options, git_worktree_list_usage, 0); if (ac) - usage_with_options(worktree_usage, options); + usage_with_options(git_worktree_list_usage, options); else if (verbose && porcelain) die(_("options '%s' and '%s' cannot be used together"), "--verbose", "--porcelain"); else if (!line_terminator && !porcelain) @@ -811,9 +870,9 @@ static int lock_worktree(int ac, const char **av, const char *prefix) }; struct worktree **worktrees, *wt; - ac = parse_options(ac, av, prefix, options, worktree_usage, 0); + ac = parse_options(ac, av, prefix, options, git_worktree_lock_usage, 0); if (ac != 1) - usage_with_options(worktree_usage, options); + usage_with_options(git_worktree_lock_usage, options); worktrees = get_worktrees(); wt = find_worktree(worktrees, prefix, av[0]); @@ -844,9 +903,9 @@ static int unlock_worktree(int ac, const char **av, const char *prefix) struct worktree **worktrees, *wt; int ret; - ac = parse_options(ac, av, prefix, options, worktree_usage, 0); + ac = parse_options(ac, av, prefix, options, git_worktree_unlock_usage, 0); if (ac != 1) - usage_with_options(worktree_usage, options); + usage_with_options(git_worktree_unlock_usage, options); worktrees = get_worktrees(); wt = find_worktree(worktrees, prefix, av[0]); @@ -914,9 +973,10 @@ static int move_worktree(int ac, const char **av, const char *prefix) const char *reason = NULL; char *path; - ac = parse_options(ac, av, prefix, options, worktree_usage, 0); + ac = parse_options(ac, av, prefix, options, git_worktree_move_usage, + 0); if (ac != 2) - usage_with_options(worktree_usage, options); + usage_with_options(git_worktree_move_usage, options); path = prefix_filename(prefix, av[1]); strbuf_addstr(&dst, path); @@ -1042,9 +1102,9 @@ static int remove_worktree(int ac, const char **av, const char *prefix) const char *reason = NULL; int ret = 0; - ac = parse_options(ac, av, prefix, options, worktree_usage, 0); + ac = parse_options(ac, av, prefix, options, git_worktree_remove_usage, 0); if (ac != 1) - usage_with_options(worktree_usage, options); + usage_with_options(git_worktree_remove_usage, options); worktrees = get_worktrees(); wt = find_worktree(worktrees, prefix, av[0]); @@ -1102,7 +1162,7 @@ static int repair(int ac, const char **av, const char *prefix) }; int rc = 0; - ac = parse_options(ac, av, prefix, options, worktree_usage, 0); + ac = parse_options(ac, av, prefix, options, git_worktree_repair_usage, 0); p = ac > 0 ? av : self; for (; *p; p++) repair_worktree_at_path(*p, report_repair, &rc); @@ -1130,6 +1190,6 @@ int cmd_worktree(int ac, const char **av, const char *prefix) if (!prefix) prefix = ""; - ac = parse_options(ac, av, prefix, options, worktree_usage, 0); + ac = parse_options(ac, av, prefix, options, git_worktree_usage, 0); return fn(ac, av, prefix); } |