@matheusbsbs / matheus-bagliano / commits / b0a5a12a60
Fork 0

unpack-trees: allow check_updates() to work on a different index

check_updates() previously assumed it was working on o->result. We want to use this function in combination with a different index_state, so take the intended index_state as a parameter. Reviewed-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Mar 27, 2020 at 00:48 UTC b0a5a12a60393237f98ec4b0fcf2b7d3c3232a2a
1 file changed +3 -3
unpack-trees.c
+3 -3
@@ -353,12 +353,12 @@ static void report_collided_checkout(struct index_state *index)
353 string_list_clear(&list, 0);
354 }
355
356 -static int check_updates(struct unpack_trees_options *o)
356 +static int check_updates(struct unpack_trees_options *o,
357 + struct index_state *index)
358 {
359 unsigned cnt = 0;
360 int errs = 0;
361 struct progress *progress;
361 - struct index_state *index = &o->result;
362 struct checkout state = CHECKOUT_INIT;
363 int i;
364
@@ -1665,7 +1665,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
1665 }
1666 }
1667
1668 - ret = check_updates(o) ? (-2) : 0;
1668 + ret = check_updates(o, &o->result) ? (-2) : 0;
1669 if (o->dst_index) {
1670 move_index_extensions(&o->result, o->src_index);
1671 if (!ret) {