Skip to content

Commit

Permalink
unpack-trees: allow check_updates() to work on a different index
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
newren authored and gitster committed Mar 27, 2020
1 parent 72064ee commit b0a5a12
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions unpack-trees.c
Expand Up @@ -353,12 +353,12 @@ static void report_collided_checkout(struct index_state *index)
string_list_clear(&list, 0);
}

static int check_updates(struct unpack_trees_options *o)
static int check_updates(struct unpack_trees_options *o,
struct index_state *index)
{
unsigned cnt = 0;
int errs = 0;
struct progress *progress;
struct index_state *index = &o->result;
struct checkout state = CHECKOUT_INIT;
int i;

Expand Down Expand Up @@ -1665,7 +1665,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
}
}

ret = check_updates(o) ? (-2) : 0;
ret = check_updates(o, &o->result) ? (-2) : 0;
if (o->dst_index) {
move_index_extensions(&o->result, o->src_index);
if (!ret) {
Expand Down

0 comments on commit b0a5a12

Please sign in to comment.