doc txt & -h consistency: make "stash" consistent

Amend both the -h output and *.txt to match one another. In this case the *.txt didn't list the "save" subcommand, and the "-h" was similarly missing some commands. Let's also convert the *.c code to use a macro definition, similar to that used in preceding commits. This avoids duplication. 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 951ec747d47e70c40625f2d37173584db4a0e13e
2 files changed +52 -26
Documentation/git-stash.txt
+4 -1
@@ -11,12 +11,15 @@ SYNOPSIS
11 'git stash' list [<log-options>]
12 'git stash' show [-u | --include-untracked | --only-untracked] [<diff-options>] [<stash>]
13 'git stash' drop [-q | --quiet] [<stash>]
14 -'git stash' (pop | apply) [--index] [-q | --quiet] [<stash>]
14 +'git stash' pop [--index] [-q | --quiet] [<stash>]
15 +'git stash' apply [--index] [-q | --quiet] [<stash>]
16 'git stash' branch <branchname> [<stash>]
17 'git stash' [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]
18 [-u | --include-untracked] [-a | --all] [(-m | --message) <message>]
19 [--pathspec-from-file=<file> [--pathspec-file-nul]]
20 [--] [<pathspec>...]]
21 +'git stash' save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]
22 + [-u | --include-untracked] [-a | --all] [<message>]
23 'git stash' clear
24 'git stash' create [<message>]
25 'git stash' store [(-m | --message) <message>] [-q | --quiet] <commit>
builtin/stash.c
+48 -25
@@ -21,72 +21,95 @@
21
22 #define INCLUDE_ALL_FILES 2
23
24 +#define BUILTIN_STASH_LIST_USAGE \
25 + N_("git stash list [<log-options>]")
26 +#define BUILTIN_STASH_SHOW_USAGE \
27 + N_("git stash show [-u | --include-untracked | --only-untracked] [<diff-options>] [<stash>]")
28 +#define BUILTIN_STASH_DROP_USAGE \
29 + N_("git stash drop [-q | --quiet] [<stash>]")
30 +#define BUILTIN_STASH_POP_USAGE \
31 + N_("git stash pop [--index] [-q | --quiet] [<stash>]")
32 +#define BUILTIN_STASH_APPLY_USAGE \
33 + N_("git stash apply [--index] [-q | --quiet] [<stash>]")
34 +#define BUILTIN_STASH_BRANCH_USAGE \
35 + N_("git stash branch <branchname> [<stash>]")
36 +#define BUILTIN_STASH_STORE_USAGE \
37 + N_("git stash store [(-m | --message) <message>] [-q | --quiet] <commit>")
38 +#define BUILTIN_STASH_PUSH_USAGE \
39 + N_("git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]\n" \
40 + " [-u | --include-untracked] [-a | --all] [(-m | --message) <message>]\n" \
41 + " [--pathspec-from-file=<file> [--pathspec-file-nul]]\n" \
42 + " [--] [<pathspec>...]]")
43 +#define BUILTIN_STASH_SAVE_USAGE \
44 + N_("git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]\n" \
45 + " [-u | --include-untracked] [-a | --all] [<message>]")
46 +#define BUILTIN_STASH_CREATE_USAGE \
47 + N_("git stash create [<message>]")
48 +#define BUILTIN_STASH_CLEAR_USAGE \
49 + "git stash clear"
50 +
51 static const char * const git_stash_usage[] = {
25 - N_("git stash list [<log-options>]"),
26 - N_("git stash show [<options>] [<stash>]"),
27 - N_("git stash drop [-q | --quiet] [<stash>]"),
28 - N_("git stash (pop | apply) [--index] [-q | --quiet] [<stash>]"),
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"
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"
36 - " [-u | --include-untracked] [-a | --all] [<message>]"),
52 + BUILTIN_STASH_LIST_USAGE,
53 + BUILTIN_STASH_SHOW_USAGE,
54 + BUILTIN_STASH_DROP_USAGE,
55 + BUILTIN_STASH_POP_USAGE,
56 + BUILTIN_STASH_APPLY_USAGE,
57 + BUILTIN_STASH_BRANCH_USAGE,
58 + BUILTIN_STASH_PUSH_USAGE,
59 + BUILTIN_STASH_SAVE_USAGE,
60 + BUILTIN_STASH_CLEAR_USAGE,
61 + BUILTIN_STASH_CREATE_USAGE,
62 + BUILTIN_STASH_STORE_USAGE,
63 NULL
64 };
65
66 static const char * const git_stash_list_usage[] = {
41 - N_("git stash list [<options>]"),
67 + BUILTIN_STASH_LIST_USAGE,
68 NULL
69 };
70
71 static const char * const git_stash_show_usage[] = {
46 - N_("git stash show [<options>] [<stash>]"),
72 + BUILTIN_STASH_SHOW_USAGE,
73 NULL
74 };
75
76 static const char * const git_stash_drop_usage[] = {
51 - N_("git stash drop [-q | --quiet] [<stash>]"),
77 + BUILTIN_STASH_DROP_USAGE,
78 NULL
79 };
80
81 static const char * const git_stash_pop_usage[] = {
56 - N_("git stash pop [--index] [-q | --quiet] [<stash>]"),
82 + BUILTIN_STASH_POP_USAGE,
83 NULL
84 };
85
86 static const char * const git_stash_apply_usage[] = {
61 - N_("git stash apply [--index] [-q | --quiet] [<stash>]"),
87 + BUILTIN_STASH_APPLY_USAGE,
88 NULL
89 };
90
91 static const char * const git_stash_branch_usage[] = {
66 - N_("git stash branch <branchname> [<stash>]"),
92 + BUILTIN_STASH_BRANCH_USAGE,
93 NULL
94 };
95
96 static const char * const git_stash_clear_usage[] = {
71 - "git stash clear",
97 + BUILTIN_STASH_CLEAR_USAGE,
98 NULL
99 };
100
101 static const char * const git_stash_store_usage[] = {
76 - N_("git stash store [(-m | --message) <message>] [-q | --quiet] <commit>"),
102 + BUILTIN_STASH_STORE_USAGE,
103 NULL
104 };
105
106 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"
83 - " [--] [<pathspec>...]]"),
107 + BUILTIN_STASH_PUSH_USAGE,
108 NULL
109 };
110
111 static const char * const git_stash_save_usage[] = {
88 - N_("git stash save [-p | --patch] [-k | --[no-]keep-index] [-q | --quiet]\n"
89 - " [-u | --include-untracked] [-a | --all] [<message>]"),
112 + BUILTIN_STASH_SAVE_USAGE,
113 NULL
114 };
115