X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=commit.c;h=aa3b35b6a86891ac9d0628e20a6a46d506bf7700;hb=8146f19762c8fd67f6df3da4ba87a4e5ea880909;hp=c99db162a48e0a47e73e6bfc2ae5fd4b7c9dfa1a;hpb=3f3e2c26fa0325f4df952363f8f5046ca8158bb3;p=git.git diff --git a/commit.c b/commit.c index c99db162a..aa3b35b6a 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;