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:
authorJunio C Hamano <junkio@cox.net>2006-12-19 11:14:04 +0300
committerJunio C Hamano <junkio@cox.net>2006-12-21 04:22:10 +0300
commit2ecd2bbcbe5335c1d9209b6ce28513e4e9d3491b (patch)
tree86d8f3803b12256607153517b804f8a80d6a332c /commit.c
parente29cb53a8b6aa1256221207b14a1c8ef72f69d9f (diff)
Move in_merge_bases() to commit.c
This reasonably useful function was hidden inside builtin-branch.c
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/commit.c b/commit.c
index 289ef65eb1..3167ce62ac 100644
--- a/commit.c
+++ b/commit.c
@@ -1009,3 +1009,20 @@ struct commit_list *get_merge_bases(struct commit *one,
free(rslt);
return result;
}
+
+int in_merge_bases(struct commit *rev1, struct commit *rev2)
+{
+ struct commit_list *bases, *b;
+ int ret = 0;
+
+ bases = get_merge_bases(rev1, rev2, 1);
+ for (b = bases; b; b = b->next) {
+ if (!hashcmp(rev1->object.sha1, b->item->object.sha1)) {
+ ret = 1;
+ break;
+ }
+ }
+
+ free_commit_list(bases);
+ return ret;
+}