commit-reach.c: allow merge_bases_many 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 18256a915c64ac9b6b7ecec4d4c22b7f6fcca507
1 file changed +7 -5
commit-reach.c
+7 -5
@@ -95,7 +95,9 @@ static struct commit_list *paint_down_to_common(struct repository *r,
95 return result;
96 }
97
98 -static struct commit_list *merge_bases_many(struct commit *one, int n, struct commit **twos)
98 +static struct commit_list *merge_bases_many(struct repository *r,
99 + struct commit *one, int n,
100 + struct commit **twos)
101 {
102 struct commit_list *list = NULL;
103 struct commit_list *result = NULL;
@@ -110,14 +112,14 @@ static struct commit_list *merge_bases_many(struct commit *one, int n, struct co
112 return commit_list_insert(one, &result);
113 }
114
113 - if (parse_commit(one))
115 + if (repo_parse_commit(r, one))
116 return NULL;
117 for (i = 0; i < n; i++) {
116 - if (parse_commit(twos[i]))
118 + if (repo_parse_commit(r, twos[i]))
119 return NULL;
120 }
121
120 - list = paint_down_to_common(the_repository, one, n, twos, 0);
122 + list = paint_down_to_common(r, one, n, twos, 0);
123
124 while (list) {
125 struct commit *commit = pop_commit(&list);
@@ -224,7 +226,7 @@ static struct commit_list *get_merge_bases_many_0(struct commit *one,
226 struct commit_list *result;
227 int cnt, i;
228
227 - result = merge_bases_many(one, n, twos);
229 + result = merge_bases_many(the_repository, one, n, twos);
230 for (i = 0; i < n; i++) {
231 if (one == twos[i])
232 return result;