summaryrefslogtreecommitdiff
path: root/midx.c
diff options
context:
space:
mode:
authorSon Luong Ngoc <sluongng@gmail.com>2020-05-10 16:07:33 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-05-10 16:50:53 (GMT)
commite11d86de13988e986550043b307b1f9a52324458 (patch)
treee6e56f7521e0192cbb7d3fb269ff9fcd7e25295b /midx.c
parentb994622632154fc3b17fb40a38819ad954a5fb88 (diff)
downloadgit-e11d86de13988e986550043b307b1f9a52324458.zip
git-e11d86de13988e986550043b307b1f9a52324458.tar.gz
git-e11d86de13988e986550043b307b1f9a52324458.tar.bz2
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 <sluongng@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'midx.c')
-rw-r--r--midx.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/midx.c b/midx.c
index 9a61d3b..d2a43bd 100644
--- a/midx.c
+++ b/midx.c
@@ -1370,6 +1370,14 @@ int midx_repack(struct repository *r, const char *object_dir, size_t batch_size,
struct strbuf base_name = STRBUF_INIT;
struct multi_pack_index *m = load_multi_pack_index(object_dir, 1);
+ /*
+ * When updating the default for these configuration
+ * variables in builtin/repack.c, these must be adjusted
+ * to match.
+ */
+ int delta_base_offset = 1;
+ int use_delta_islands = 0;
+
if (!m)
return 0;
@@ -1381,12 +1389,20 @@ int midx_repack(struct repository *r, const char *object_dir, size_t batch_size,
} else if (fill_included_packs_all(m, include_pack))
goto cleanup;
+ repo_config_get_bool(r, "repack.usedeltabaseoffset", &delta_base_offset);
+ repo_config_get_bool(r, "repack.usedeltaislands", &use_delta_islands);
+
argv_array_push(&cmd.args, "pack-objects");
strbuf_addstr(&base_name, object_dir);
strbuf_addstr(&base_name, "/pack/pack");
argv_array_push(&cmd.args, base_name.buf);
+ if (delta_base_offset)
+ argv_array_push(&cmd.args, "--delta-base-offset");
+ if (use_delta_islands)
+ argv_array_push(&cmd.args, "--delta-islands");
+
if (flags & MIDX_PROGRESS)
argv_array_push(&cmd.args, "--progress");
else