]> git.ipfire.org Git - thirdparty/git.git/commitdiff
unpack-trees: allow check_updates() to work on a different index
authorElijah Newren <newren@gmail.com>
Fri, 27 Mar 2020 00:48:49 +0000 (00:48 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 27 Mar 2020 18:33:29 +0000 (11:33 -0700)
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>
unpack-trees.c

index d2863fa03107a0ef16c9d485f22793c449b81479..dde50047a8246bbd97ed0367394ed5648b2a2972 100644 (file)
@@ -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;
 
@@ -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) {