]> Kevux Git Server - rit/commit
pack-objects: perform name-hash traversal for unpacked objects
authorTaylor Blau <me@ttaylorr.com>
Mon, 23 Jun 2025 22:32:21 +0000 (18:32 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 23 Jun 2025 22:41:36 +0000 (15:41 -0700)
commitd6220cce6beda5404effa7107b7544a3d8c6266a
tree9c0a5108e7aacee4a0c20ae7d5b5cad17666e118
parent97ec43247c01bc125fa9618e54f93a7dd0b52ab4
pack-objects: perform name-hash traversal for unpacked objects

With '--unpacked', pack-objects adds loose objects (which don't appear
in any of the excluded packs from '--stdin-packs') to the output pack
without considering them as reachability tips for the name-hash
traversal.

This was an oversight in the original implementation of '--stdin-packs',
since the code which enumerates and adds loose objects to the output
pack (`add_unreachable_loose_objects()`) did not have access to the
'rev_info' struct found in `read_packs_list_from_stdin()`.

Excluding unpacked objects from that traversal doesn't affect the
correctness of the resulting pack, but it does make it harder to
discover good deltas for loose objects.

Now that the 'rev_info' struct is declared outside of
`read_packs_list_from_stdin()`, we can pass it to
`add_objects_in_unpacked_packs()` and add any loose objects as tips to
the above-mentioned traversal, in theory producing slightly tighter
packs as a result.

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