Skip to content

Commit 8757b35

Browse files
avargitster
authored andcommitted
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. 809e032 (builtin/commit-graph.c: introduce '--max-new-filters=<n>', 2020-09-18). See b25b727 (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>
1 parent c420321 commit 8757b35

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

builtin/commit-graph.c

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,29 @@
99
#include "progress.h"
1010
#include "tag.h"
1111

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,
1823
NULL
1924
};
2025

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,
2328
NULL
2429
};
2530

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,
3235
};
3336

3437
static struct opts_commit_graph {

0 commit comments

Comments
 (0)