diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-08-11 04:52:32 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-08-11 04:52:32 (GMT) |
commit | a6aeb2fef9850e05c51e36a8c05b019e2954b2ef (patch) | |
tree | 313a06c36dc37a83b2e504abd269601cd82ec526 /revision.c | |
parent | a5b4466536668ce595300de249412b2c5b97deb1 (diff) | |
parent | e0ad13977a7f6226d753ec12aedaaa9db7e57dad (diff) | |
download | git-a6aeb2fef9850e05c51e36a8c05b019e2954b2ef.zip git-a6aeb2fef9850e05c51e36a8c05b019e2954b2ef.tar.gz git-a6aeb2fef9850e05c51e36a8c05b019e2954b2ef.tar.bz2 |
Merge branch 'jc/resolve-undo' into maint
The resolve-undo information in the index was not protected against
GC, which has been corrected.
source: <xmqq35f7kzad.fsf@gitster.g>
* jc/resolve-undo:
fsck: do not dereference NULL while checking resolve-undo data
revision: mark blobs needed for resolve-undo as reachable
Diffstat (limited to 'revision.c')
-rw-r--r-- | revision.c | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -33,6 +33,7 @@ #include "bloom.h" #include "json-writer.h" #include "list-objects-filter-options.h" +#include "resolve-undo.h" volatile show_early_output_fn_t show_early_output; @@ -1696,6 +1697,39 @@ static void add_cache_tree(struct cache_tree *it, struct rev_info *revs, } +static void add_resolve_undo_to_pending(struct index_state *istate, struct rev_info *revs) +{ + struct string_list_item *item; + struct string_list *resolve_undo = istate->resolve_undo; + + if (!resolve_undo) + return; + + for_each_string_list_item(item, resolve_undo) { + const char *path = item->string; + struct resolve_undo_info *ru = item->util; + int i; + + if (!ru) + continue; + for (i = 0; i < 3; i++) { + struct blob *blob; + + if (!ru->mode[i] || !S_ISREG(ru->mode[i])) + continue; + + blob = lookup_blob(revs->repo, &ru->oid[i]); + if (!blob) { + warning(_("resolve-undo records `%s` which is missing"), + oid_to_hex(&ru->oid[i])); + continue; + } + add_pending_object_with_path(revs, &blob->object, "", + ru->mode[i], path); + } + } +} + static void do_add_index_objects_to_pending(struct rev_info *revs, struct index_state *istate, unsigned int flags) @@ -1724,6 +1758,8 @@ static void do_add_index_objects_to_pending(struct rev_info *revs, add_cache_tree(istate->cache_tree, revs, &path, flags); strbuf_release(&path); } + + add_resolve_undo_to_pending(istate, revs); } void add_index_objects_to_pending(struct rev_info *revs, unsigned int flags) |