From 040b572d95e4ca27e1ada6113c405b8a1eb4a669 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Wed, 11 Mar 2026 20:41:32 +0800 Subject: commitquery: Merge from ancestor and mergebases --- internal/commitquery/ancestor.go | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 internal/commitquery/ancestor.go (limited to 'internal/commitquery/ancestor.go') 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 -} -- cgit v1.3.1-10-gc9f91