Compare canonical paths by token spelling

This commit is contained in:
2026-10-09 03:23:08 +00:00
parent edc6660654
commit 9ac65ccc08
5 changed files with 151 additions and 16 deletions

View File

@@ -337,12 +337,12 @@ func pathContains(container, descendant Path) bool {
if !container.valid() || !descendant.valid() || len(container.segments) > len(descendant.segments) {
return false
}
if container.String() == "" {
return true
for i, segment := range container.segments {
if !pathTokenSpellingEqual(segment, descendant.segments[i]) {
return false
}
}
prefix := container.String()
value := descendant.String()
return value == prefix || strings.HasPrefix(value, prefix+"/")
return true
}
func appendUniqueString(values []string, value string) []string {
@@ -354,7 +354,7 @@ func appendUniqueString(values []string, value string) []string {
func appendUniquePath(paths []Path, path Path) []Path {
for _, existing := range paths {
if existing.String() == path.String() {
if pathSpellingEqual(existing, path) {
return paths
}
}