commit-reach.c: allow remove_redundant to handle any repo

Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stefan Beller committed Nov 13, 2018 at 16:12 UTC ed8a0e3ac5e9c2c625bb86f0de5a82f91075e720
1 file changed +5 -5
commit-reach.c
+5 -5
@@ -156,7 +156,7 @@ struct commit_list *get_octopus_merge_bases(struct commit_list *in)
156 return ret;
157 }
158
159 -static int remove_redundant(struct commit **array, int cnt)
159 +static int remove_redundant(struct repository *r, struct commit **array, int cnt)
160 {
161 /*
162 * Some commit in the array may be an ancestor of
@@ -174,7 +174,7 @@ static int remove_redundant(struct commit **array, int cnt)
174 ALLOC_ARRAY(filled_index, cnt - 1);
175
176 for (i = 0; i < cnt; i++)
177 - parse_commit(array[i]);
177 + repo_parse_commit(r, array[i]);
178 for (i = 0; i < cnt; i++) {
179 struct commit_list *common;
180 uint32_t min_generation = array[i]->generation;
@@ -190,7 +190,7 @@ static int remove_redundant(struct commit **array, int cnt)
190 if (array[j]->generation < min_generation)
191 min_generation = array[j]->generation;
192 }
193 - common = paint_down_to_common(the_repository, array[i], filled,
193 + common = paint_down_to_common(r, array[i], filled,
194 work, min_generation);
195 if (array[i]->object.flags & PARENT2)
196 redundant[i] = 1;
@@ -249,7 +249,7 @@ static struct commit_list *get_merge_bases_many_0(struct commit *one,
249 clear_commit_marks(one, all_flags);
250 clear_commit_marks_many(n, twos, all_flags);
251
252 - cnt = remove_redundant(rslt, cnt);
252 + cnt = remove_redundant(the_repository, rslt, cnt);
253 result = NULL;
254 for (i = 0; i < cnt; i++)
255 commit_list_insert_by_date(rslt[i], &result);
@@ -370,7 +370,7 @@ struct commit_list *reduce_heads(struct commit_list *heads)
370 p->item->object.flags &= ~STALE;
371 }
372 }
373 - num_head = remove_redundant(array, num_head);
373 + num_head = remove_redundant(the_repository, array, num_head);
374 for (i = 0; i < num_head; i++)
375 tail = &commit_list_insert(array[i], tail)->next;
376 free(array);