summaryrefslogtreecommitdiff
path: root/src/graph.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/graph.c')
-rw-r--r--src/graph.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/graph.c b/src/graph.c
index 277f588ca..f39af5ed5 100644
--- a/src/graph.c
+++ b/src/graph.c
@@ -176,3 +176,17 @@ on_error:
git_revwalk_free(walk);
return -1;
}
+
+int git_graph_descendant_of(git_repository *repo, const git_oid *commit, const git_oid *ancestor)
+{
+ git_oid merge_base;
+ int error;
+
+ if (git_oid_equal(commit, ancestor))
+ return 0;
+
+ if ((error = git_merge_base(&merge_base, repo, commit, ancestor) < 0))
+ return error;
+
+ return git_oid_equal(&merge_base, ancestor);
+}