doc txt & -h consistency: add missing options and labels

Fix various issues of SYNOPSIS and -h output syntax where:

 * Options such as --force were missing entirely
 * ...or the short option, such as -f

 * We said "opts" or "options", but could instead enumerate
   the (small) set of supported options

 * Options that were missing entirely (ls-remote's --sort=<key>)

   As we can specify "--sort" multiple times (it's backed by a
   string-list" it should really be "[(--sort=<key>)...]", which is
   what "git for-each-ref" lists it as, but let's leave that issue for
   a subsequent cleanup, and stop at making these consistent. Other
   "ref-filter.h" users share the same issue, e.g. "git-branch.txt".

 * For "verify-tag" and "verify-commit" we were missing the "--raw"
   option.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ævar Arnfjörð Bjarmason 2022-10-13 17:39:13 +02:00 committed by Junio C Hamano
parent 8f5f2f646a
commit 8c9e292dc0
19 changed files with 40 additions and 26 deletions

View File

@ -9,7 +9,8 @@ git-send-pack - Push objects over Git protocol to another repository
SYNOPSIS
--------
[verse]
'git send-pack' [--dry-run] [--force] [--receive-pack=<git-receive-pack>]
'git send-pack' [--mirror] [--dry-run] [--force]
[--receive-pack=<git-receive-pack>]
[--verbose] [--thin] [--atomic]
[--[no-]signed | --signed=(true|false|if-asked)]
[<host>:]<directory> (--all | <ref>...)

View File

@ -9,7 +9,7 @@ git-sparse-checkout - Reduce your working tree to a subset of tracked files
SYNOPSIS
--------
[verse]
'git sparse-checkout' <subcommand> [<options>]
'git sparse-checkout' (init | list | set | add | reapply | disable) [<options>]
DESCRIPTION

View File

@ -9,7 +9,7 @@ git-update-server-info - Update auxiliary info file to help dumb servers
SYNOPSIS
--------
[verse]
'git update-server-info'
'git update-server-info' [-f | --force]
DESCRIPTION
-----------
@ -19,6 +19,12 @@ $GIT_OBJECT_DIRECTORY/info directories to help clients discover
what references and packs the server has. This command
generates such auxiliary files.
OPTIONS
-------
-f::
--force::
update the info files from scratch.
OUTPUT
------

View File

@ -8,7 +8,7 @@ git-verify-commit - Check the GPG signature of commits
SYNOPSIS
--------
[verse]
'git verify-commit' <commit>...
'git verify-commit' [-v | --verbose] [--raw] <commit>...
DESCRIPTION
-----------

View File

@ -8,7 +8,7 @@ git-verify-tag - Check the GPG signature of tags
SYNOPSIS
--------
[verse]
'git verify-tag' [--format=<format>] <tag>...
'git verify-tag' [-v | --verbose] [--format=<format>] [--raw] <tag>...
DESCRIPTION
-----------

View File

@ -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;

View File

@ -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
};

View File

@ -9,7 +9,7 @@
#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;

View File

@ -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
};

View File

@ -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
};

View File

@ -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
};

View File

@ -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,
};

View File

@ -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] <name>"),
N_("git symbolic-ref [-m <reason>] <name> <ref>"),
N_("git symbolic-ref [-q] [--short] <name>"),
N_("git symbolic-ref --delete [-q] <name>"),
NULL
};

View File

@ -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
};

View File

@ -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
};

View File

@ -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
};

View File

@ -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
};

View File

@ -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
};

2
help.c
View File

@ -757,7 +757,7 @@ int cmd_version(int argc, const char **argv, const char *prefix)
struct strbuf buf = STRBUF_INIT;
int build_options = 0;
const char * const usage[] = {
N_("git version [<options>]"),
N_("git version [--build-options]"),
NULL
};
struct option options[] = {