diff options
author | Carlo Marcelo Arenas Belón <carenas@gmail.com> | 2020-06-23 21:42:22 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-06-24 02:36:53 +0300 |
commit | c1ea625f72110fda87fd225d7dff002befb82d9f (patch) | |
tree | b3f7a3f5b3bfee8395931651796095df7111baeb /commit-reach.c | |
parent | 80b8ada54756e972b01d20b98a388fbbc3a2fe58 (diff) |
commit-reach: avoid is_descendant_of() shim
d91d6fbf26 (commit-reach: create repo_is_descendant_of(), 2020-06-17)
adds a repository aware version of is_descendant_of() and a backward
compatibility shim that is barely used.
Update all callers to directly use the new repo_is_descendant_of()
function instead; making the codebase simpler and pushing more
the_repository references higher up the stack.
Helped-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-reach.c')
-rw-r--r-- | commit-reach.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/commit-reach.c b/commit-reach.c index 43e303d5f2..2d85265a35 100644 --- a/commit-reach.c +++ b/commit-reach.c @@ -283,9 +283,9 @@ struct commit_list *repo_get_merge_bases(struct repository *r, /* * Is "commit" a descendant of one of the elements on the "with_commit" list? */ -static int repo_is_descendant_of(struct repository *r, - struct commit *commit, - struct commit_list *with_commit) +int repo_is_descendant_of(struct repository *r, + struct commit *commit, + struct commit_list *with_commit) { if (!with_commit) return 1; @@ -310,11 +310,6 @@ static int repo_is_descendant_of(struct repository *r, } } -int is_descendant_of(struct commit *commit, struct commit_list *with_commit) -{ - return repo_is_descendant_of(the_repository, commit, with_commit); -} - /* * Is "commit" an ancestor of one of the "references"? */ @@ -432,7 +427,8 @@ int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid) return 0; commit_list_insert(old_commit, &old_commit_list); - return is_descendant_of(new_commit, old_commit_list); + return repo_is_descendant_of(the_repository, + new_commit, old_commit_list); } /* @@ -551,7 +547,7 @@ int commit_contains(struct ref_filter *filter, struct commit *commit, { if (filter->with_commit_tag_algo) return contains_tag_algo(commit, list, cache) == CONTAINS_YES; - return is_descendant_of(commit, list); + return repo_is_descendant_of(the_repository, commit, list); } static int compare_commits_by_gen(const void *_a, const void *_b) |