commit-graph: define common usage with a macro

Share the usage message between these three variables by using a macro. Before this new options needed to copy/paste the usage information, see e.g. 809e0327f5 (builtin/commit-graph.c: introduce '--max-new-filters=<n>', 2020-09-18). See b25b727494f (builtin/multi-pack-index.c: define common usage with a macro, 2021-03-30) for another use of this pattern (but on-list this one came first). Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Reviewed-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Aug 23, 2021 at 14:30 UTC 8757b35d443ea01fb6298ae622362c5490a60198
1 file changed +17 -14
builtin/commit-graph.c
+17 -14
@@ -9,26 +9,29 @@
9 #include "progress.h"
10 #include "tag.h"
11
12 -static char const * const builtin_commit_graph_usage[] = {
13 - N_("git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress]"),
14 - N_("git commit-graph write [--object-dir <objdir>] [--append] "
15 - "[--split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] "
16 - "[--changed-paths] [--[no-]max-new-filters <n>] [--[no-]progress] "
17 - "<split options>"),
12 +#define BUILTIN_COMMIT_GRAPH_VERIFY_USAGE \
13 + N_("git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress]")
14 +
15 +#define BUILTIN_COMMIT_GRAPH_WRITE_USAGE \
16 + N_("git commit-graph write [--object-dir <objdir>] [--append] " \
17 + "[--split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] " \
18 + "[--changed-paths] [--[no-]max-new-filters <n>] [--[no-]progress] " \
19 + "<split options>")
20 +
21 +static const char * builtin_commit_graph_verify_usage[] = {
22 + BUILTIN_COMMIT_GRAPH_VERIFY_USAGE,
23 NULL
24 };
25
21 -static const char * const builtin_commit_graph_verify_usage[] = {
22 - N_("git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress]"),
26 +static const char * builtin_commit_graph_write_usage[] = {
27 + BUILTIN_COMMIT_GRAPH_WRITE_USAGE,
28 NULL
29 };
30
26 -static const char * const builtin_commit_graph_write_usage[] = {
27 - N_("git commit-graph write [--object-dir <objdir>] [--append] "
28 - "[--split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] "
29 - "[--changed-paths] [--[no-]max-new-filters <n>] [--[no-]progress] "
30 - "<split options>"),
31 - NULL
31 +static char const * const builtin_commit_graph_usage[] = {
32 + BUILTIN_COMMIT_GRAPH_VERIFY_USAGE,
33 + BUILTIN_COMMIT_GRAPH_WRITE_USAGE,
34 + NULL,
35 };
36
37 static struct opts_commit_graph {