]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/repack.c
repack: honor `-l` when calculating pack geometry
authorPatrick Steinhardt <ps@pks.im>
Fri, 14 Apr 2023 06:02:08 +0000 (08:02 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 14 Apr 2023 17:27:52 +0000 (10:27 -0700)
commit932c16c04b5e41ee1c76d5640ec3ae67e1900c07
treed56c922bdd27dd752066292b505d8b6087eecba2
parent19a3a7bde9164c86353c944e939a1dcb537993f9
repack: honor `-l` when calculating pack geometry

When the user passes `-l` to git-repack(1), then they essentially ask us
to only repack objects part of the local object database while ignoring
any packfiles part of an alternate object database. And we in fact honor
this bit when doing a geometric repack as the resulting packfile will
only ever contain local objects.

What we're missing though is that we don't take locality of packfiles
into account when computing whether the geometric sequence is intact or
not. So even though we would only ever roll up local packfiles anyway,
we could end up trying to repack because of non-local packfiles. This
does not make much sense, and in the worst case it can cause us to try
and do the geometric repack over and over again because we're never able
to restore the geometric sequence.

Fix this bug by honoring whether the user has passed `-l`. If so, we
skip adding any non-local packfiles to the pack geometry.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/repack.c
t/t7703-repack-geometric.sh