Skip to content

Commit 061dd72

Browse files
dschogitster
authored andcommitted
unpack-trees: take care to propagate the split-index flag
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent be6b65b commit 061dd72

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

unpack-trees.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1916,6 +1916,8 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
19161916
* create a new one.
19171917
*/
19181918
o->result.split_index = o->src_index->split_index;
1919+
if (o->src_index->cache_changed & SPLIT_INDEX_ORDERED)
1920+
o->result.cache_changed |= SPLIT_INDEX_ORDERED;
19191921
o->result.split_index->refcount++;
19201922
} else {
19211923
o->result.split_index = init_split_index(&o->result);

0 commit comments

Comments
 (0)