Skip to content

Commit 19f6e8d

Browse files
ttaylorrgitster
authored andcommitted
builtin/repack.c: pass both pack_objects args to repack_config
A subsequent commit will remove 'delta_base_offset' as a static variable within builtin/repack.c, and reintroduce it as a member of the 'struct pack_objects_args'. As a result, the repack_config callback will need to have both the cruft- and non-cruft 'struct pack_objects_args's in scope. Introduce a new 'struct repack_config_ctx' to allow the callee to provide both pointers to the callback. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent c7a1207 commit 19f6e8d

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

builtin/repack.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,16 @@ static const char incremental_bitmap_conflict_error[] = N_(
5454
"--no-write-bitmap-index or disable the pack.writeBitmaps configuration."
5555
);
5656

57+
struct repack_config_ctx {
58+
struct pack_objects_args *po_args;
59+
struct pack_objects_args *cruft_po_args;
60+
};
61+
5762
static int repack_config(const char *var, const char *value,
5863
const struct config_context *ctx, void *cb)
5964
{
60-
struct pack_objects_args *cruft_po_args = cb;
65+
struct repack_config_ctx *repack_ctx = cb;
66+
struct pack_objects_args *cruft_po_args = repack_ctx->cruft_po_args;
6167
if (!strcmp(var, "repack.usedeltabaseoffset")) {
6268
delta_base_offset = git_config_bool(var, value);
6369
return 0;
@@ -1260,6 +1266,7 @@ int cmd_repack(int argc,
12601266
size_t midx_pack_names_nr = 0;
12611267

12621268
/* variables to be filled by option parsing */
1269+
struct repack_config_ctx config_ctx;
12631270
int delete_redundant = 0;
12641271
const char *unpack_unreachable = NULL;
12651272
int keep_unreachable = 0;
@@ -1343,7 +1350,11 @@ int cmd_repack(int argc,
13431350

13441351
list_objects_filter_init(&po_args.filter_options);
13451352

1346-
repo_config(repo, repack_config, &cruft_po_args);
1353+
memset(&config_ctx, 0, sizeof(config_ctx));
1354+
config_ctx.po_args = &po_args;
1355+
config_ctx.cruft_po_args = &cruft_po_args;
1356+
1357+
repo_config(repo, repack_config, &config_ctx);
13471358

13481359
argc = parse_options(argc, argv, prefix, builtin_repack_options,
13491360
git_repack_usage, 0);

0 commit comments

Comments
 (0)