]> git.ipfire.org Git - thirdparty/git.git/commitdiff
doc txt & -h consistency: fix incorrect alternates syntax
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Thu, 13 Oct 2022 15:39:03 +0000 (17:39 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 13 Oct 2022 16:32:55 +0000 (09:32 -0700)
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>
Documentation/git-stash.txt
builtin/bugreport.c
builtin/diagnose.c
builtin/stash.c

index 6e15f47525765ce3da66b793ab519abd1cd90784..0df21321e5081b2426588f4d8a1018c7adb3facb 100644 (file)
@@ -14,12 +14,12 @@ SYNOPSIS
 'git stash' ( pop | apply ) [--index] [-q|--quiet] [<stash>]
 'git stash' branch <branchname> [<stash>]
 'git stash' [push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--quiet]
-            [-u|--include-untracked] [-a|--all] [-m|--message <message>]
+            [-u|--include-untracked] [-a|--all] [(-m|--message) <message>]
             [--pathspec-from-file=<file> [--pathspec-file-nul]]
             [--] [<pathspec>...]]
 'git stash' clear
 'git stash' create [<message>]
-'git stash' store [-m|--message <message>] [-q|--quiet] <commit>
+'git stash' store [(-m|--message) <message>] [-q|--quiet] <commit>
 
 DESCRIPTION
 -----------
@@ -47,7 +47,7 @@ stash index (e.g. the integer `n` is equivalent to `stash@{n}`).
 COMMANDS
 --------
 
-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>...]::
+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>...]::
 
        Save your local modifications to a new 'stash entry' and roll them
        back to HEAD (in the working tree and in the index).
index faa268f3cfb1f2733ea377d034615d8542a8b320..23170113cc807bd569653778d47659c26762fdbc 100644 (file)
@@ -60,7 +60,7 @@ 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>]\n"
+       N_("git bugreport [(-o|--output-directory) <file>] [(-s|--suffix) <format>]\n"
           "              [--diagnose[=<mode>]"),
        NULL
 };
index c7672fa99e20910d6ccb67542783c27d28fb728a..54491f2c51c25fbe354f25dc14b4aa0f649bedd1 100644 (file)
@@ -3,7 +3,7 @@
 #include "diagnose.h"
 
 static const char * const diagnose_usage[] = {
-       N_("git diagnose [-o|--output-directory <path>] [-s|--suffix <format>]\n"
+       N_("git diagnose [(-o|--output-directory) <path>] [(-s|--suffix) <format>]\n"
           "             [--mode=<mode>]"),
        NULL
 };
index 1ba24c117378c9ab1ea2d180ed1b15ea87f45674..0fc359e9d39e2ba9720de04cd04c9137c5038e43 100644 (file)
@@ -29,7 +29,7 @@ static const char * const git_stash_usage[] = {
        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"
+          "          [-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"
@@ -73,13 +73,13 @@ static const char * const git_stash_clear_usage[] = {
 };
 
 static const char * const git_stash_store_usage[] = {
-       N_("git stash store [-m|--message <message>] [-q|--quiet] <commit>"),
+       N_("git stash store [(-m|--message) <message>] [-q|--quiet] <commit>"),
        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"
+          "          [-u|--include-untracked] [-a|--all] [(-m|--message) <message>]\n"
           "          [--] [<pathspec>...]]"),
        NULL
 };