diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-07-19 16:40:16 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-07-19 16:40:16 -0700 |
commit | 418aef9055c3ca85ae6439e7e76c91558f04d94b (patch) | |
tree | ead11d6ddd5f0ba06e4ac5b9dbe05d3c77d289d7 /revision.c | |
parent | 71a8fab31b70c417e8f5b5f716581f89955a7082 (diff) | |
parent | e0ad13977a7f6226d753ec12aedaaa9db7e57dad (diff) | |
download | git-418aef9055c3ca85ae6439e7e76c91558f04d94b.tar.gz |
Merge branch 'jc/resolve-undo'
The resolve-undo information in the index was not protected against
GC, which has been corrected.
* 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
diff --git a/revision.c b/revision.c index 211352795c..0c6e26cd9c 100644 --- a/revision.c +++ b/revision.c @@ -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) |