]> git.ipfire.org Git - thirdparty/git.git/commitdiff
unpack-trees: take care to propagate the split-index flag
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Sun, 26 Mar 2023 22:45:43 +0000 (22:45 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 27 Mar 2023 16:40:40 +0000 (09:40 -0700)
When copying the `split_index` structure from one index structure to
another, we need to propagate the `SPLIT_INDEX_ORDERED` flag, too, if it
is set, otherwise Git might forget to write the shared index when that
is actually needed.

It just so _happens_ that in many instances when `unpack_trees()` is
called, the result causes the shared index to be written anyway, but
there are edge cases when that is not so.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
unpack-trees.c

index 90b92114be8558b63371531aecfa246829317840..ca5e47c77c01313104bc3d79ba6c12bde285ceae 100644 (file)
@@ -1916,6 +1916,8 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
                 * create a new one.
                 */
                o->result.split_index = o->src_index->split_index;
+               if (o->src_index->cache_changed & SPLIT_INDEX_ORDERED)
+                       o->result.cache_changed |= SPLIT_INDEX_ORDERED;
                o->result.split_index->refcount++;
        } else {
                o->result.split_index = init_split_index(&o->result);