Skip to content

Commit b0a5a12

Browse files
newrengitster
authored andcommitted
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 <[email protected]> Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 72064ee commit b0a5a12

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

unpack-trees.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,12 +353,12 @@ static void report_collided_checkout(struct index_state *index)
353353
string_list_clear(&list, 0);
354354
}
355355

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)
357358
{
358359
unsigned cnt = 0;
359360
int errs = 0;
360361
struct progress *progress;
361-
struct index_state *index = &o->result;
362362
struct checkout state = CHECKOUT_INIT;
363363
int i;
364364

@@ -1665,7 +1665,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
16651665
}
16661666
}
16671667

1668-
ret = check_updates(o) ? (-2) : 0;
1668+
ret = check_updates(o, &o->result) ? (-2) : 0;
16691669
if (o->dst_index) {
16701670
move_index_extensions(&o->result, o->src_index);
16711671
if (!ret) {

0 commit comments

Comments
 (0)