aboutsummaryrefslogtreecommitdiff
path: root/internal/commitquery/ancestor.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/commitquery/ancestor.go')
-rw-r--r--internal/commitquery/ancestor.go30
1 files changed, 0 insertions, 30 deletions
diff --git a/internal/commitquery/ancestor.go b/internal/commitquery/ancestor.go
deleted file mode 100644
index d050ce08..00000000
--- a/internal/commitquery/ancestor.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package commitquery
-
-// IsAncestor reports whether ancestor is reachable from descendant through
-// commit parent edges.
-func IsAncestor(ctx *Context, ancestor, descendant NodeIndex) (bool, error) {
- if ancestor == descendant {
- return true, nil
- }
-
- ancestorGeneration := ctx.EffectiveGeneration(ancestor)
- descendantGeneration := ctx.EffectiveGeneration(descendant)
-
- if ancestorGeneration != generationInfinity &&
- descendantGeneration != generationInfinity &&
- ancestorGeneration > descendantGeneration {
- return false, nil
- }
-
- minGeneration := uint64(0)
- if ancestorGeneration != generationInfinity {
- minGeneration = ancestorGeneration
- }
-
- err := paintDownToCommon(ctx, ancestor, []NodeIndex{descendant}, minGeneration)
- if err != nil {
- return false, err
- }
-
- return ctx.HasAnyMarks(ancestor, markRight), nil
-}