commit-reach.c: allow paint_down_to_common to handle any repo
As the function is file local and not widely used, migrate it all at once. 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
c383830a91fcaf402db1051a9cec2eb93cdd6b78
1 file changed
+9
-6
commit-reach.c
+9
-6
@@ -30,7 +30,8 @@ static int queue_has_nonstale(struct prio_queue *queue)
30
}
31
32
/* all input commits in one and twos[] must have been parsed! */
33
-static struct commit_list *paint_down_to_common(struct commit *one, int n,
33
+static struct commit_list *paint_down_to_common(struct repository *r,
34
+ struct commit *one, int n,
35
struct commit **twos,
36
int min_generation)
37
{
@@ -83,7 +84,7 @@ static struct commit_list *paint_down_to_common(struct commit *one, int n,
84
parents = parents->next;
85
if ((p->object.flags & flags) == flags)
86
continue;
86
- if (parse_commit(p))
87
+ if (repo_parse_commit(r, p))
88
return NULL;
89
p->object.flags |= flags;
90
prio_queue_put(&queue, p);
@@ -116,7 +117,7 @@ static struct commit_list *merge_bases_many(struct commit *one, int n, struct co
117
return NULL;
118
}
119
119
- list = paint_down_to_common(one, n, twos, 0);
120
+ list = paint_down_to_common(the_repository, one, n, twos, 0);
121
122
while (list) {
123
struct commit *commit = pop_commit(&list);
@@ -187,8 +188,8 @@ static int remove_redundant(struct commit **array, int cnt)
188
if (array[j]->generation < min_generation)
189
min_generation = array[j]->generation;
190
}
190
- common = paint_down_to_common(array[i], filled, work,
191
- min_generation);
191
+ common = paint_down_to_common(the_repository, array[i], filled,
192
+ work, min_generation);
193
if (array[i]->object.flags & PARENT2)
194
redundant[i] = 1;
195
for (j = 0; j < filled; j++)
@@ -322,7 +323,9 @@ int in_merge_bases_many(struct commit *commit, int nr_reference, struct commit *
323
if (commit->generation > min_generation)
324
return ret;
325
325
- bases = paint_down_to_common(commit, nr_reference, reference, commit->generation);
326
+ bases = paint_down_to_common(the_repository, commit,
327
+ nr_reference, reference,
328
+ commit->generation);
329
if (commit->object.flags & PARENT2)
330
ret = 1;
331
clear_commit_marks(commit, all_flags);