revision: mark blobs needed for resolve-undo as reachable
commit5a5ea141e7d5317cd049cb1e93b9127c1cec04bb
authorJunio C Hamano <gitster@pobox.com>
Thu, 9 Jun 2022 23:44:20 +0000 (9 16:44 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 9 Jun 2022 23:45:07 +0000 (9 16:45 -0700)
tree6da54ee57cbeacf4ee7efe51ec8dcdbe0792bc26
parentdc8c8deaa6b5847733bd7df011a4c7b7d1a64e0a
revision: mark blobs needed for resolve-undo as reachable

The resolve-undo extension was added to the index in cfc5789a
(resolve-undo: record resolved conflicts in a new index extension
section, 2009-12-25).  This extension records the blob object names
and their modes of conflicted paths when the path gets resolved
(e.g. with "git add"), to allow "undoing" the resolution with
"checkout -m path".  These blob objects should be guarded from
garbage-collection while we have the resolve-undo information in the
index (otherwise unresolve operation may try to use a blob object
that has already been pruned away).

But the code called from mark_reachable_objects() for the index
forgets to do so.  Teach add_index_objects_to_pending() helper to
also add objects referred to by the resolve-undo extension.

Also make matching changes to "fsck", which has code that is fairly
similar to the reachability stuff, but have parallel implementations
for all these stuff, which may (or may not) someday want to be unified.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fsck.c
revision.c
t/t2030-unresolve-info.sh