lstat_cache(): print a warning if doing ping-pong between cache types
[gitweb.git] / commit.c
index 10e532afe1b383a2f49702f9ff0e932ccab43a43..cf72143f58346c93879a98709d5d6fa8a0981b40 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -706,6 +706,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;