Skip to content

Commit f587d16

Browse files
avargitster
authored andcommitted
bundle: define subcommand -h in terms of command -h
Avoid repeating the "-h" output for the "git bundle" command, and instead define the usage of each subcommand with macros, so that the "-h" output for the command itself can re-use those definitions. See [1], [2] and [3] for prior art using the same pattern. 1. b25b727 (builtin/multi-pack-index.c: define common usage with a macro, 2021-03-30) 2. 8757b35 (commit-graph: define common usage with a macro, 2021-08-23) 3. 1e91d3f (reflog: move "usage" variables and use macros, 2022-03-17) Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 968a04e commit f587d16

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

builtin/bundle.c

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,40 @@
1111
* bundle supporting "fetch", "pull", and "ls-remote".
1212
*/
1313

14-
static const char * const builtin_bundle_usage[] = {
15-
N_("git bundle create [<options>] <file> <git-rev-list args>"),
16-
N_("git bundle verify [<options>] <file>"),
17-
N_("git bundle list-heads <file> [<refname>...]"),
18-
N_("git bundle unbundle <file> [<refname>...]"),
19-
NULL
14+
#define BUILTIN_BUNDLE_CREATE_USAGE \
15+
N_("git bundle create [<options>] <file> <git-rev-list args>")
16+
#define BUILTIN_BUNDLE_VERIFY_USAGE \
17+
N_("git bundle verify [<options>] <file>")
18+
#define BUILTIN_BUNDLE_LIST_HEADS_USAGE \
19+
N_("git bundle list-heads <file> [<refname>...]")
20+
#define BUILTIN_BUNDLE_UNBUNDLE_USAGE \
21+
N_("git bundle unbundle <file> [<refname>...]")
22+
23+
static char const * const builtin_bundle_usage[] = {
24+
BUILTIN_BUNDLE_CREATE_USAGE,
25+
BUILTIN_BUNDLE_VERIFY_USAGE,
26+
BUILTIN_BUNDLE_LIST_HEADS_USAGE,
27+
BUILTIN_BUNDLE_UNBUNDLE_USAGE,
28+
NULL,
2029
};
2130

2231
static const char * const builtin_bundle_create_usage[] = {
23-
N_("git bundle create [<options>] <file> <git-rev-list args>"),
32+
BUILTIN_BUNDLE_CREATE_USAGE,
2433
NULL
2534
};
2635

2736
static const char * const builtin_bundle_verify_usage[] = {
28-
N_("git bundle verify [<options>] <file>"),
37+
BUILTIN_BUNDLE_VERIFY_USAGE,
2938
NULL
3039
};
3140

3241
static const char * const builtin_bundle_list_heads_usage[] = {
33-
N_("git bundle list-heads <file> [<refname>...]"),
42+
BUILTIN_BUNDLE_LIST_HEADS_USAGE,
3443
NULL
3544
};
3645

3746
static const char * const builtin_bundle_unbundle_usage[] = {
38-
N_("git bundle unbundle <file> [<refname>...]"),
47+
BUILTIN_BUNDLE_UNBUNDLE_USAGE,
3948
NULL
4049
};
4150

0 commit comments

Comments
 (0)