Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2020-06-17 20:24:28 +0300
committerJunio C Hamano <gitster@pobox.com>2020-06-17 23:49:36 +0300
commitd91d6fbf26663ab64c453411c2de6cf4ea754246 (patch)
tree63b7873c5d804f73647273fe5e85640941b59b6c /commit-reach.c
parenteebb51ba8cab97c0b3f3f18eaab7796803b8494b (diff)
commit-reach: create repo_is_descendant_of()
The next change will make repo_in_merge_bases() depend on the logic in is_descendant_of(), but we need to make the method independent of the_repository first. Signed-off-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.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/commit-reach.c b/commit-reach.c
index 4ca7e706a1..13722430aa 100644
--- a/commit-reach.c
+++ b/commit-reach.c
@@ -283,7 +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?
*/
-int is_descendant_of(struct commit *commit, struct commit_list *with_commit)
+static int repo_is_descendant_of(struct repository *r,
+ struct commit *commit,
+ struct commit_list *with_commit)
{
if (!with_commit)
return 1;
@@ -301,13 +303,18 @@ int is_descendant_of(struct commit *commit, struct commit_list *with_commit)
other = with_commit->item;
with_commit = with_commit->next;
- if (in_merge_bases(other, commit))
+ if (repo_in_merge_bases(r, other, commit))
return 1;
}
return 0;
}
}
+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"?
*/