[PATCH v2 06/18] unpack-trees: allow check_updates() to work on a different index
- From
Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Mar 21, 2020, 17:59 UTC
- Message-ID
- <5fea19f0136a849c70f18591d88abae8cee99841.1584813609.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.726.v2.git.git.1584813609.gitgitgadget@gmail.com>
From: Elijah Newren <newren@gmail.com>
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.
Signed-off-by: Elijah Newren <newren@gmail.com> --- unpack-trees.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/unpack-trees.c b/unpack-trees.c index d2863fa0310..dde50047a82 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -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) {
-- gitgitgadget