commit-reach: prepare get_merge_bases to handle any repo

Similarly to previous patches, the get_merge_base functions are used
often in the code base, which makes migrating them hard.

Implement the new functions, prefixed with 'repo_' and hide the old
functions behind a wrapper macro.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Stefan Beller
2018-11-13 16:12:55 -08:00
committed by Junio C Hamano
parent f28e87f526
commit 21a9651ba3
3 changed files with 56 additions and 20 deletions

View File

@ -258,23 +258,27 @@ static struct commit_list *get_merge_bases_many_0(struct repository *r,
return result;
}
struct commit_list *get_merge_bases_many(struct commit *one,
int n,
struct commit **twos)
struct commit_list *repo_get_merge_bases_many(struct repository *r,
struct commit *one,
int n,
struct commit **twos)
{
return get_merge_bases_many_0(the_repository, one, n, twos, 1);
return get_merge_bases_many_0(r, one, n, twos, 1);
}
struct commit_list *get_merge_bases_many_dirty(struct commit *one,
int n,
struct commit **twos)
struct commit_list *repo_get_merge_bases_many_dirty(struct repository *r,
struct commit *one,
int n,
struct commit **twos)
{
return get_merge_bases_many_0(the_repository, one, n, twos, 0);
return get_merge_bases_many_0(r, one, n, twos, 0);
}
struct commit_list *get_merge_bases(struct commit *one, struct commit *two)
struct commit_list *repo_get_merge_bases(struct repository *r,
struct commit *one,
struct commit *two)
{
return get_merge_bases_many_0(the_repository, one, 1, &two, 1);
return get_merge_bases_many_0(r, one, 1, &two, 1);
}
/*