X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=commit.c;h=aa3b35b6a86891ac9d0628e20a6a46d506bf7700;hb=8321c56b6bae25a2d70790f452df894be536b32c;hp=dc0c5bfdab7296bf7febb6f1b1aad64550838c15;hpb=10d9d887ecdc81197162d7bbe5dfc0d028498fd6;p=git.git diff --git a/commit.c b/commit.c index dc0c5bfda..aa3b35b6a 100644 --- a/commit.c +++ b/commit.c @@ -160,7 +160,7 @@ struct commit_graft *read_graft_line(char *buf, int len) return graft; } -int read_graft_file(const char *graft_file) +static int read_graft_file(const char *graft_file) { FILE *fp = fopen(graft_file, "r"); char buf[1024]; @@ -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;