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 238b439d698 (bugreport: add tool to generate debugging info, 2020-04-16), and for "diagnose" in 6783fd3cef0 (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 bd514cada4b (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 <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Oct 13, 2022 at 17:39 UTC d4056dba1fbe7a0b1e36eab34b9a2ff8435f86a4
4 files changed +8 -8
Documentation/git-stash.txt
+3 -3
@@ -14,12 +14,12 @@ SYNOPSIS
14 'git stash' ( pop | apply ) [--index] [-q|--quiet] [<stash>]
15 'git stash' branch <branchname> [<stash>]
16 '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>]
18 [--pathspec-from-file=<file> [--pathspec-file-nul]]
19 [--] [<pathspec>...]]
20 'git stash' clear
21 'git stash' create [<message>]
22 -'git stash' store [-m|--message <message>] [-q|--quiet] <commit>
22 +'git stash' store [(-m|--message) <message>] [-q|--quiet] <commit>
23
24 DESCRIPTION
25 -----------
@@ -47,7 +47,7 @@ stash index (e.g. the integer `n` is equivalent to `stash@{n}`).
47 COMMANDS
48 --------
49
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>...]::
51
52 Save your local modifications to a new 'stash entry' and roll them
53 back to HEAD (in the working tree and in the index).
builtin/bugreport.c
+1 -1
@@ -60,7 +60,7 @@ static void get_populated_hooks(struct strbuf *hook_info, int nongit)
60 }
61
62 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"
64 " [--diagnose[=<mode>]"),
65 NULL
66 };
builtin/diagnose.c
+1 -1
@@ -3,7 +3,7 @@
3 #include "diagnose.h"
4
5 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"
7 " [--mode=<mode>]"),
8 NULL
9 };
builtin/stash.c
+3 -3
@@ -29,7 +29,7 @@ static const char * const git_stash_usage[] = {
29 N_("git stash branch <branchname> [<stash>]"),
30 "git stash clear",
31 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"
33 " [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
34 " [--] [<pathspec>...]]"),
35 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[] = {
73 };
74
75 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>"),
77 NULL
78 };
79
80 static const char * const git_stash_push_usage[] = {
81 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"
83 " [--] [<pathspec>...]]"),
84 NULL
85 };