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>

Taylor Blau committed Oct 15, 2025 at 18:27 UTC 19f6e8d023057113fe8c5890349593e70541bec2
1 file changed +13 -2
builtin/repack.c
+13 -2
@@ -54,10 +54,16 @@ static const char incremental_bitmap_conflict_error[] = N_(
54 "--no-write-bitmap-index or disable the pack.writeBitmaps configuration."
55 );
56
57 +struct repack_config_ctx {
58 + struct pack_objects_args *po_args;
59 + struct pack_objects_args *cruft_po_args;
60 +};
61 +
62 static int repack_config(const char *var, const char *value,
63 const struct config_context *ctx, void *cb)
64 {
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;
67 if (!strcmp(var, "repack.usedeltabaseoffset")) {
68 delta_base_offset = git_config_bool(var, value);
69 return 0;
@@ -1260,6 +1266,7 @@ int cmd_repack(int argc,
1266 size_t midx_pack_names_nr = 0;
1267
1268 /* variables to be filled by option parsing */
1269 + struct repack_config_ctx config_ctx;
1270 int delete_redundant = 0;
1271 const char *unpack_unreachable = NULL;
1272 int keep_unreachable = 0;
@@ -1343,7 +1350,11 @@ int cmd_repack(int argc,
1350
1351 list_objects_filter_init(&po_args.filter_options);
1352
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);
1358
1359 argc = parse_options(argc, argv, prefix, builtin_repack_options,
1360 git_repack_usage, 0);