]> git.ipfire.org Git - thirdparty/git.git/commit
midx.c: avoid adding preferred objects twice
authorTaylor Blau <me@ttaylorr.com>
Mon, 22 Aug 2022 19:50:49 +0000 (15:50 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Aug 2022 20:04:22 +0000 (13:04 -0700)
commit99e4d084ffc4c6f8cb28ec61fdbb44facdd47ac7
treef7fdc3fd0311b33bbb681e045a0a4e9888508d7c
parentcdf517be06b83c01d0411709c1fac0c2fc5c1a9b
midx.c: avoid adding preferred objects twice

The last commit changes the behavior of midx.c's `get_sorted_objects()`
function to handle the case of writing a MIDX bitmap while reusing an
existing MIDX and changing the identity of the preferred pack
separately.

As part of this change, all objects from the (new) preferred pack are
added to the fanout table in a separate pass. Since these copies of the
objects all have their preferred bits set, any duplicates will be
resolved in their favor.

Importantly, this includes any copies of those same objects that come
from the existing MIDX. We know at the time of adding them that they'll
be redundant if their source pack is the (new) preferred one, so we can
avoid adding them to the list in this case.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
midx.c