Skip to content
  • Derrick Stolee's avatar
    multi-pack-index: repack batches below --batch-size · 1eb22c7d
    Derrick Stolee authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    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: default avatarDerrick Stolee <dstolee@microsoft.com>
    Reviewed-by: default avatarTaylor Blau <me@ttaylorr.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    1eb22c7d