aboutsummaryrefslogtreecommitdiff
path: root/commitquery/queries_ancestor.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-28 17:40:02 +0000
committerGravatar Runxi Yu2026-03-28 17:40:02 +0000
commit06583274fa64ad6677773bf4ca54f69226388203 (patch)
tree66354bf972d267bf7ee5135eb7e5b90c31f9fe4d /commitquery/queries_ancestor.go
parentformat/commitgraph/read: Lifetime (diff)
signatureNo signature
commitquery: Make a reusable engine thingy
Diffstat (limited to 'commitquery/queries_ancestor.go')
-rw-r--r--commitquery/queries_ancestor.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/commitquery/queries_ancestor.go b/commitquery/queries_ancestor.go
new file mode 100644
index 00000000..e2c955c6
--- /dev/null
+++ b/commitquery/queries_ancestor.go
@@ -0,0 +1,14 @@
+package commitquery
+
+import objectid "codeberg.org/lindenii/furgit/object/id"
+
+// IsAncestor reports whether ancestor is reachable from descendant through
+// commit parent edges.
+//
+// Both inputs are peeled through annotated tags before commit traversal.
+func (queries *Queries) IsAncestor(ancestor, descendant objectid.ObjectID) (bool, error) {
+ query := queries.acquire()
+ defer queries.release(query)
+
+ return query.IsAncestor(ancestor, descendant)
+}