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>
This commit is contained in:
parent
18256a915c
commit
ed8a0e3ac5
@ -156,7 +156,7 @@ struct commit_list *get_octopus_merge_bases(struct commit_list *in)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int remove_redundant(struct commit **array, int cnt)
|
||||
static int remove_redundant(struct repository *r, struct commit **array, int cnt)
|
||||
{
|
||||
/*
|
||||
* Some commit in the array may be an ancestor of
|
||||
@ -174,7 +174,7 @@ static int remove_redundant(struct commit **array, int cnt)
|
||||
ALLOC_ARRAY(filled_index, cnt - 1);
|
||||
|
||||
for (i = 0; i < cnt; i++)
|
||||
parse_commit(array[i]);
|
||||
repo_parse_commit(r, array[i]);
|
||||
for (i = 0; i < cnt; i++) {
|
||||
struct commit_list *common;
|
||||
uint32_t min_generation = array[i]->generation;
|
||||
@ -190,7 +190,7 @@ static int remove_redundant(struct commit **array, int cnt)
|
||||
if (array[j]->generation < min_generation)
|
||||
min_generation = array[j]->generation;
|
||||
}
|
||||
common = paint_down_to_common(the_repository, array[i], filled,
|
||||
common = paint_down_to_common(r, array[i], filled,
|
||||
work, min_generation);
|
||||
if (array[i]->object.flags & PARENT2)
|
||||
redundant[i] = 1;
|
||||
@ -249,7 +249,7 @@ static struct commit_list *get_merge_bases_many_0(struct commit *one,
|
||||
clear_commit_marks(one, all_flags);
|
||||
clear_commit_marks_many(n, twos, all_flags);
|
||||
|
||||
cnt = remove_redundant(rslt, cnt);
|
||||
cnt = remove_redundant(the_repository, rslt, cnt);
|
||||
result = NULL;
|
||||
for (i = 0; i < cnt; i++)
|
||||
commit_list_insert_by_date(rslt[i], &result);
|
||||
@ -370,7 +370,7 @@ struct commit_list *reduce_heads(struct commit_list *heads)
|
||||
p->item->object.flags &= ~STALE;
|
||||
}
|
||||
}
|
||||
num_head = remove_redundant(array, num_head);
|
||||
num_head = remove_redundant(the_repository, array, num_head);
|
||||
for (i = 0; i < num_head; i++)
|
||||
tail = &commit_list_insert(array[i], tail)->next;
|
||||
free(array);
|
||||
|
Loading…
Reference in New Issue
Block a user