Skip to content

Commit e11d86d

Browse files
sluongnggitster
authored andcommitted
midx: teach "git multi-pack-index repack" honor "git repack" configurations
When the "repack" subcommand of "git multi-pack-index" command creates new packfile(s), it does not call the "git repack" command but instead directly calls the "git pack-objects" command, and the configuration variables meant for the "git repack" command, like "repack.usedaeltabaseoffset", are ignored. Check the configuration variables used by "git repack" ourselves in "git multi-index-pack" and pass the corresponding options to underlying "git pack-objects". Note that `repack.writeBitmaps` configuration is ignored, as the pack bitmap facility is useful only with a single packfile. Signed-off-by: Son Luong Ngoc <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b994622 commit e11d86d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

midx.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,6 +1370,14 @@ int midx_repack(struct repository *r, const char *object_dir, size_t batch_size,
13701370
struct strbuf base_name = STRBUF_INIT;
13711371
struct multi_pack_index *m = load_multi_pack_index(object_dir, 1);
13721372

1373+
/*
1374+
* When updating the default for these configuration
1375+
* variables in builtin/repack.c, these must be adjusted
1376+
* to match.
1377+
*/
1378+
int delta_base_offset = 1;
1379+
int use_delta_islands = 0;
1380+
13731381
if (!m)
13741382
return 0;
13751383

@@ -1381,12 +1389,20 @@ int midx_repack(struct repository *r, const char *object_dir, size_t batch_size,
13811389
} else if (fill_included_packs_all(m, include_pack))
13821390
goto cleanup;
13831391

1392+
repo_config_get_bool(r, "repack.usedeltabaseoffset", &delta_base_offset);
1393+
repo_config_get_bool(r, "repack.usedeltaislands", &use_delta_islands);
1394+
13841395
argv_array_push(&cmd.args, "pack-objects");
13851396

13861397
strbuf_addstr(&base_name, object_dir);
13871398
strbuf_addstr(&base_name, "/pack/pack");
13881399
argv_array_push(&cmd.args, base_name.buf);
13891400

1401+
if (delta_base_offset)
1402+
argv_array_push(&cmd.args, "--delta-base-offset");
1403+
if (use_delta_islands)
1404+
argv_array_push(&cmd.args, "--delta-islands");
1405+
13901406
if (flags & MIDX_PROGRESS)
13911407
argv_array_push(&cmd.args, "--progress");
13921408
else

0 commit comments

Comments
 (0)