From: Ævar Arnfjörð Bjarmason Date: Sat, 11 Sep 2021 19:09:01 GMT Subject: [PATCH v3 2/6] blame: replace usage end blurb with better option spec Message-ID: In-Reply-To: Change the "git blame -h" output to be consistent with "git bundle -h"'s, i.e. before this we'd emit: $ git blame -h usage: git blame [] [] [] [--] are documented in git-rev-list(1) [...] Now instead of that we'll emit: $ git blame -h usage: git blame [] [] [] [--] [...] This makes it consistent with the usage spec used for "git bundle": $ git bundle -h usage: git bundle create [] [...] The use of this in "blame" dated back to 5817da01434 (git-blame: migrate to incremental parse-option [1/2], 2008-07-08), and the use in "bundle" to 2e0afafebd8 (Add git-bundle: move objects and references by archive, 2007-02-22). Once we get rid of this special case we can also use usage_msg_opt() to emit the error message we'd get on an invalid "-L " argument, which means we can get rid of the old-style "blame_usage" variable entirely. This makes the output friendlier, before we'd emit say: $ git blame -L1,2,3,4 Makefile usage: git blame [] [] [] [--] $ Now we'll instead emit: $ git blame -L1,2,3,4 Makefile fatal: Invalid -L parameter usage: git blame [] [] [] [--] [...] $ The "[...]" there elides the "git blame" option summary. Signed-off-by: Ævar Arnfjörð Bjarmason --- builtin/blame.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/builtin/blame.c b/builtin/blame.c index 641523ff9af..e469829bc76 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -29,12 +29,8 @@ #include "refs.h" #include "tag.h" -static char blame_usage[] = N_("git blame [] [] [] [--] "); - static const char *blame_opt_usage[] = { - blame_usage, - "", - N_(" are documented in git-rev-list(1)"), + N_("git blame [] [] [] [--] "), NULL }; @@ -1107,7 +1103,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix) nth_line_cb, &sb, lno, anchor, &bottom, &top, sb.path, the_repository->index)) - usage(blame_usage); + usage_msg_opt(_("Invalid -L parameter"), + blame_opt_usage, options); if ((!lno && (top || bottom)) || lno < bottom) die(Q_("file %s has only %lu line", "file %s has only %lu lines", -- 2.33.0.995.ga5ea46173a2