]> git.ipfire.org Git - thirdparty/git.git/commitdiff
commit-graph: define common usage with a macro
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Mon, 23 Aug 2021 12:30:15 +0000 (14:30 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 31 Aug 2021 00:06:18 +0000 (17:06 -0700)
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>
builtin/commit-graph.c

index cd8631522167e1c1f23da9038bf58ce87c17fa94..5af3cd7178f38e3a575e43425adcc0e78d867888 100644 (file)
@@ -9,26 +9,29 @@
 #include "progress.h"
 #include "tag.h"
 
-static char const * const builtin_commit_graph_usage[] = {
-       N_("git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress]"),
-       N_("git commit-graph write [--object-dir <objdir>] [--append] "
-          "[--split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] "
-          "[--changed-paths] [--[no-]max-new-filters <n>] [--[no-]progress] "
-          "<split options>"),
+#define BUILTIN_COMMIT_GRAPH_VERIFY_USAGE \
+       N_("git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress]")
+
+#define BUILTIN_COMMIT_GRAPH_WRITE_USAGE \
+       N_("git commit-graph write [--object-dir <objdir>] [--append] " \
+          "[--split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] " \
+          "[--changed-paths] [--[no-]max-new-filters <n>] [--[no-]progress] " \
+          "<split options>")
+
+static const char * builtin_commit_graph_verify_usage[] = {
+       BUILTIN_COMMIT_GRAPH_VERIFY_USAGE,
        NULL
 };
 
-static const char * const builtin_commit_graph_verify_usage[] = {
-       N_("git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress]"),
+static const char * builtin_commit_graph_write_usage[] = {
+       BUILTIN_COMMIT_GRAPH_WRITE_USAGE,
        NULL
 };
 
-static const char * const builtin_commit_graph_write_usage[] = {
-       N_("git commit-graph write [--object-dir <objdir>] [--append] "
-          "[--split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] "
-          "[--changed-paths] [--[no-]max-new-filters <n>] [--[no-]progress] "
-          "<split options>"),
-       NULL
+static char const * const builtin_commit_graph_usage[] = {
+       BUILTIN_COMMIT_GRAPH_VERIFY_USAGE,
+       BUILTIN_COMMIT_GRAPH_WRITE_USAGE,
+       NULL,
 };
 
 static struct opts_commit_graph {