Skip to content

Commit d4056db

Browse files
avargitster
authored andcommitted
doc txt & -h consistency: fix incorrect alternates syntax
Fix the incorrect "[-o | --option <argument>]" syntax, which should be "[(-o | --option) <argument>]", we were previously claiming that only the long option accepted the "<argument>", which isn't what we meant. This syntax issue for "bugreport" originated in 238b439 (bugreport: add tool to generate debugging info, 2020-04-16), and for "diagnose" in 6783fd3 (builtin/diagnose.c: create 'git diagnose' builtin, 2022-08-12), which copied and adjusted "bugreport" documentation and code. In the case of "Documentation/git-stash.txt" and "builtin/stash.c" this is not a "doc txt & -h consistency" change, as we're changing both versions, doing so here makes a subsequent change smaller. In that case fix the incorrect "[-o | --option <argument>]" syntax, which should be "[(-o | --option) <argument>]", we were previously claiming that only the long option accepted the "<argument>", which isn't what we meant. The "stash" issue has been with us in both the "-h" and *.txt versions since bd514ca (stash: introduce 'git stash store', 2013-06-15). We could claim that this isn't a syntax issue if a "vertical bar binds tighter than option and its argument", but such a rule would change e.g. this "cat-file" SYNOPSIS example to mean something we don't: ... [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>] We have various other examples where the post-image here is already used, e.g. for "format-patch" ("-o"), "grep" ("-m"), "submodule" ("set-branch -b") etc. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5af8b61 commit d4056db

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

Documentation/git-stash.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ SYNOPSIS
1414
'git stash' ( pop | apply ) [--index] [-q|--quiet] [<stash>]
1515
'git stash' branch <branchname> [<stash>]
1616
'git stash' [push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--quiet]
17-
[-u|--include-untracked] [-a|--all] [-m|--message <message>]
17+
[-u|--include-untracked] [-a|--all] [(-m|--message) <message>]
1818
[--pathspec-from-file=<file> [--pathspec-file-nul]]
1919
[--] [<pathspec>...]]
2020
'git stash' clear
2121
'git stash' create [<message>]
22-
'git stash' store [-m|--message <message>] [-q|--quiet] <commit>
22+
'git stash' store [(-m|--message) <message>] [-q|--quiet] <commit>
2323

2424
DESCRIPTION
2525
-----------
@@ -47,7 +47,7 @@ stash index (e.g. the integer `n` is equivalent to `stash@{n}`).
4747
COMMANDS
4848
--------
4949

50-
push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--quiet] [-m|--message <message>] [--pathspec-from-file=<file> [--pathspec-file-nul]] [--] [<pathspec>...]::
50+
push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--quiet] [(-m|--message) <message>] [--pathspec-from-file=<file> [--pathspec-file-nul]] [--] [<pathspec>...]::
5151

5252
Save your local modifications to a new 'stash entry' and roll them
5353
back to HEAD (in the working tree and in the index).

builtin/bugreport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static void get_populated_hooks(struct strbuf *hook_info, int nongit)
6060
}
6161

6262
static const char * const bugreport_usage[] = {
63-
N_("git bugreport [-o|--output-directory <file>] [-s|--suffix <format>]\n"
63+
N_("git bugreport [(-o|--output-directory) <file>] [(-s|--suffix) <format>]\n"
6464
" [--diagnose[=<mode>]"),
6565
NULL
6666
};

builtin/diagnose.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "diagnose.h"
44

55
static const char * const diagnose_usage[] = {
6-
N_("git diagnose [-o|--output-directory <path>] [-s|--suffix <format>]\n"
6+
N_("git diagnose [(-o|--output-directory) <path>] [(-s|--suffix) <format>]\n"
77
" [--mode=<mode>]"),
88
NULL
99
};

builtin/stash.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static const char * const git_stash_usage[] = {
2929
N_("git stash branch <branchname> [<stash>]"),
3030
"git stash clear",
3131
N_("git stash [push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--quiet]\n"
32-
" [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
32+
" [-u|--include-untracked] [-a|--all] [(-m|--message) <message>]\n"
3333
" [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
3434
" [--] [<pathspec>...]]"),
3535
N_("git stash save [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--quiet]\n"
@@ -73,13 +73,13 @@ static const char * const git_stash_clear_usage[] = {
7373
};
7474

7575
static const char * const git_stash_store_usage[] = {
76-
N_("git stash store [-m|--message <message>] [-q|--quiet] <commit>"),
76+
N_("git stash store [(-m|--message) <message>] [-q|--quiet] <commit>"),
7777
NULL
7878
};
7979

8080
static const char * const git_stash_push_usage[] = {
8181
N_("git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
82-
" [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
82+
" [-u|--include-untracked] [-a|--all] [(-m|--message) <message>]\n"
8383
" [--] [<pathspec>...]]"),
8484
NULL
8585
};

0 commit comments

Comments
 (0)