summaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-01-31 18:07:59 -0800
committerJunio C Hamano <gitster@pobox.com>2009-01-31 18:07:59 -0800
commitb37f26d8a2d4551b8ee365e66cbaf3d03b05e74d (patch)
treec0cbe3de06f95fd4f799d938a8b59b23ffb1e70d /commit.c
parent29254142ddac335b33606c0036561f6df89f3d18 (diff)
parent32c35cfb1e9c8523b9d60e5095f1c49ebaef0279 (diff)
downloadgit-b37f26d8a2d4551b8ee365e66cbaf3d03b05e74d.tar.gz
Merge branch 'jg/tag-contains'
* jg/tag-contains: git-tag: Add --contains option Make has_commit() non-static Make opt_parse_with_commit() non-static
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/commit.c b/commit.c
index c99db162a4..aa3b35b6a8 100644
--- a/commit.c
+++ b/commit.c
@@ -705,6 +705,21 @@ struct commit_list *get_merge_bases(struct commit *one, struct commit *two,
return get_merge_bases_many(one, 1, &two, cleanup);
}
+int is_descendant_of(struct commit *commit, struct commit_list *with_commit)
+{
+ if (!with_commit)
+ return 1;
+ while (with_commit) {
+ struct commit *other;
+
+ other = with_commit->item;
+ with_commit = with_commit->next;
+ if (in_merge_bases(other, &commit, 1))
+ return 1;
+ }
+ return 0;
+}
+
int in_merge_bases(struct commit *commit, struct commit **reference, int num)
{
struct commit_list *bases, *b;