X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=commit.c;h=0a05a1075ad228f1f38f61cc5278edeb8604ebfb;hb=a20efee9cfcf9c68bb01d0aa82ffc7903d88bab4;hp=35af4988f0ff83c6a3379ea9f6de4e4e1568c39f;hpb=c08afaf7b6675f3780f041870233e31b77ac4ce8;p=thirdparty%2Fgit.git diff --git a/commit.c b/commit.c index 35af4988f0..0a05a1075a 100644 --- a/commit.c +++ b/commit.c @@ -754,6 +754,9 @@ struct commit_list *get_merge_bases(struct commit *one, struct commit *two, return get_merge_bases_many(one, 1, &two, cleanup); } +/* + * Is "commit" a decendant of one of the elements on the "with_commit" list? + */ int is_descendant_of(struct commit *commit, struct commit_list *with_commit) { if (!with_commit) @@ -763,21 +766,21 @@ 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, 1)) + if (in_merge_bases(other, commit)) return 1; } return 0; } -int in_merge_bases(struct commit *commit, struct commit **reference, int num) +/* + * Is "commit" an ancestor of (i.e. reachable from) the "reference"? + */ +int in_merge_bases(struct commit *commit, struct commit *reference) { struct commit_list *bases, *b; int ret = 0; - if (num == 1) - bases = get_merge_bases(commit, *reference, 1); - else - die("not yet"); + bases = get_merge_bases(commit, reference, 1); for (b = bases; b; b = b->next) { if (!hashcmp(commit->object.sha1, b->item->object.sha1)) { ret = 1;