Re: [PATCH v2 04/15] builtin/multi-pack-index.c: split sub-commands
From: Jonathan Tan <hidden>
Date: 2021-03-02 15:28:34
quoted hunk ↗ jump to hunk
diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c index eea498e026..caf0248a98 100644 --- a/builtin/multi-pack-index.c +++ b/builtin/multi-pack-index.c@@ -5,17 +5,33 @@ #include "midx.h" #include "trace2.h" +static char const * const builtin_multi_pack_index_write_usage[] = { #define BUILTIN_MIDX_WRITE_USAGE \ N_("git multi-pack-index [<options>] write") + BUILTIN_MIDX_WRITE_USAGE, + NULL +};
I think this way of writing is vulnerable to confusing errors if a missing or extra backslash happens, so I would prefer the #define to be outside the variable declaration.
+static int cmd_multi_pack_index_repack(int argc, const char **argv)
+{
+ struct option *options;
+ static struct option builtin_multi_pack_index_repack_options[] = {
OPT_MAGNITUDE(0, "batch-size", &opts.batch_size,
N_("during repack, collect pack-files of smaller size into a batch that is larger than this size")),
OPT_END(),
};
+ options = parse_options_dup(builtin_multi_pack_index_repack_options);
+ options = add_common_options(options);I looked for where this was freed, but I guess freeing this struct is not really something we're worried about (which makes sense). The other patches up to this one look good.