summaryrefslogtreecommitdiff
path: root/midx.c
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2020-08-11 15:30:18 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-08-11 21:05:26 (GMT)
commit1eb22c7dd803fc05513fde0bd96befeb8c725e05 (patch)
treea9a3c9fd0f1f6f659dee8dec832480dd311e897c /midx.c
parent4f0a8be78499454eac3985b6e7e144b8376ab0a5 (diff)
downloadgit-1eb22c7dd803fc05513fde0bd96befeb8c725e05.zip
git-1eb22c7dd803fc05513fde0bd96befeb8c725e05.tar.gz
git-1eb22c7dd803fc05513fde0bd96befeb8c725e05.tar.bz2
multi-pack-index: repack batches below --batch-size
The --batch-size=<size> option of 'git multi-pack-index repack' is intended to limit the amount of work done by the repack. In the case of a large repository, this command should repack a number of small pack-files but leave the large pack-files alone. Most often, the repository has one large pack-file from a 'git clone' operation and number of smaller pack-files from incremental 'git fetch' operations. The issue with '--batch-size' is that it also _prevents_ the repack from happening if the expected size of the resulting pack-file is too small. This was intended as a way to avoid frequent churn of small pack-files, but it has mostly caused confusion when a repository is of "medium" size. That is, not enormous like the Windows OS repository, but also not so small that this incremental repack isn't valuable. The solution presented here is to collect pack-files for repack if their expected size is smaller than the batch-size parameter until either the total expected size exceeds the batch-size or all pack-files are considered. If there are at least two pack-files, then these are combined to a new pack-file whose size should not be too much larger than the batch-size. This new strategy should succeed in keeping the number of pack-files small in these "medium" size repositories. The concern about churn is likely not interesting, as the real control over that is the frequency in which the repack command is run. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Reviewed-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'midx.c')
-rw-r--r--midx.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/midx.c b/midx.c
index a5fb797..55afc8d 100644
--- a/midx.c
+++ b/midx.c
@@ -1371,7 +1371,7 @@ static int fill_included_packs_batch(struct repository *r,
free(pack_info);
- if (total_size < batch_size || packs_to_repack < 2)
+ if (packs_to_repack < 2)
return 1;
return 0;