From 951ec747d47e70c40625f2d37173584db4a0e13e Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Thu, 13 Oct 2022 17:39:19 +0200 Subject: [PATCH] doc txt & -h consistency: make "stash" consistent MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano --- Documentation/git-stash.txt | 5 +++- builtin/stash.c | 73 +++++++++++++++++++++++++++++---------------- 2 files changed, 52 insertions(+), 26 deletions(-) diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt index 379bea645d..c350a3b8da 100644 --- a/Documentation/git-stash.txt +++ b/Documentation/git-stash.txt @@ -11,12 +11,15 @@ SYNOPSIS 'git stash' list [] 'git stash' show [-u | --include-untracked | --only-untracked] [] [] 'git stash' drop [-q | --quiet] [] -'git stash' (pop | apply) [--index] [-q | --quiet] [] +'git stash' pop [--index] [-q | --quiet] [] +'git stash' apply [--index] [-q | --quiet] [] 'git stash' branch [] 'git stash' [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet] [-u | --include-untracked] [-a | --all] [(-m | --message) ] [--pathspec-from-file= [--pathspec-file-nul]] [--] [...]] +'git stash' save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet] + [-u | --include-untracked] [-a | --all] [] 'git stash' clear 'git stash' create [] 'git stash' store [(-m | --message) ] [-q | --quiet] diff --git a/builtin/stash.c b/builtin/stash.c index 614bb0dd4a..7cc2b403d5 100644 --- a/builtin/stash.c +++ b/builtin/stash.c @@ -21,72 +21,95 @@ #define INCLUDE_ALL_FILES 2 +#define BUILTIN_STASH_LIST_USAGE \ + N_("git stash list []") +#define BUILTIN_STASH_SHOW_USAGE \ + N_("git stash show [-u | --include-untracked | --only-untracked] [] []") +#define BUILTIN_STASH_DROP_USAGE \ + N_("git stash drop [-q | --quiet] []") +#define BUILTIN_STASH_POP_USAGE \ + N_("git stash pop [--index] [-q | --quiet] []") +#define BUILTIN_STASH_APPLY_USAGE \ + N_("git stash apply [--index] [-q | --quiet] []") +#define BUILTIN_STASH_BRANCH_USAGE \ + N_("git stash branch []") +#define BUILTIN_STASH_STORE_USAGE \ + N_("git stash store [(-m | --message) ] [-q | --quiet] ") +#define BUILTIN_STASH_PUSH_USAGE \ + N_("git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]\n" \ + " [-u | --include-untracked] [-a | --all] [(-m | --message) ]\n" \ + " [--pathspec-from-file= [--pathspec-file-nul]]\n" \ + " [--] [...]]") +#define BUILTIN_STASH_SAVE_USAGE \ + N_("git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]\n" \ + " [-u | --include-untracked] [-a | --all] []") +#define BUILTIN_STASH_CREATE_USAGE \ + N_("git stash create []") +#define BUILTIN_STASH_CLEAR_USAGE \ + "git stash clear" + static const char * const git_stash_usage[] = { - N_("git stash list []"), - N_("git stash show [] []"), - N_("git stash drop [-q | --quiet] []"), - N_("git stash (pop | apply) [--index] [-q | --quiet] []"), - N_("git stash branch []"), - "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) ]\n" - " [--pathspec-from-file= [--pathspec-file-nul]]\n" - " [--] [...]]"), - N_("git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]\n" - " [-u | --include-untracked] [-a | --all] []"), + BUILTIN_STASH_LIST_USAGE, + BUILTIN_STASH_SHOW_USAGE, + BUILTIN_STASH_DROP_USAGE, + BUILTIN_STASH_POP_USAGE, + BUILTIN_STASH_APPLY_USAGE, + BUILTIN_STASH_BRANCH_USAGE, + BUILTIN_STASH_PUSH_USAGE, + BUILTIN_STASH_SAVE_USAGE, + BUILTIN_STASH_CLEAR_USAGE, + BUILTIN_STASH_CREATE_USAGE, + BUILTIN_STASH_STORE_USAGE, NULL }; static const char * const git_stash_list_usage[] = { - N_("git stash list []"), + BUILTIN_STASH_LIST_USAGE, NULL }; static const char * const git_stash_show_usage[] = { - N_("git stash show [] []"), + BUILTIN_STASH_SHOW_USAGE, NULL }; static const char * const git_stash_drop_usage[] = { - N_("git stash drop [-q | --quiet] []"), + BUILTIN_STASH_DROP_USAGE, NULL }; static const char * const git_stash_pop_usage[] = { - N_("git stash pop [--index] [-q | --quiet] []"), + BUILTIN_STASH_POP_USAGE, NULL }; static const char * const git_stash_apply_usage[] = { - N_("git stash apply [--index] [-q | --quiet] []"), + BUILTIN_STASH_APPLY_USAGE, NULL }; static const char * const git_stash_branch_usage[] = { - N_("git stash branch []"), + BUILTIN_STASH_BRANCH_USAGE, NULL }; static const char * const git_stash_clear_usage[] = { - "git stash clear", + BUILTIN_STASH_CLEAR_USAGE, NULL }; static const char * const git_stash_store_usage[] = { - N_("git stash store [(-m | --message) ] [-q | --quiet] "), + BUILTIN_STASH_STORE_USAGE, 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) ]\n" - " [--] [...]]"), + BUILTIN_STASH_PUSH_USAGE, NULL }; static const char * const git_stash_save_usage[] = { - N_("git stash save [-p | --patch] [-k | --[no-]keep-index] [-q | --quiet]\n" - " [-u | --include-untracked] [-a | --all] []"), + BUILTIN_STASH_SAVE_USAGE, NULL }; -- 2.11.4.GIT