Skip to content

Conversation

@rconnell9
Copy link
Contributor

Avoid expensive string array operations when performing isDescendent checks on AbsolutePath

Motivation:

#9304

Modifications:

Rely on path normalization and perform standard prefix checks.

@rconnell9
Copy link
Contributor Author

@swift-ci test

@rconnell9
Copy link
Contributor Author

@swift-ci test macOS smoke test

@rconnell9
Copy link
Contributor Author

@swift-ci test macOS

@rconnell9
Copy link
Contributor Author

@swift-ci test

@rconnell9
Copy link
Contributor Author

@swift-ci test windows

1 similar comment
@rconnell9
Copy link
Contributor Author

@swift-ci test windows

@rconnell9
Copy link
Contributor Author

@swift-ci test windows self hosted

@rconnell9
Copy link
Contributor Author

@swift-ci test windows

return false
}

if ancestorPath.hasSuffix("/") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT pathString will have windows separators on Windows, which this won't match

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally thought they may all be normalized to "/" by TSC.

///
/// This method is strictly syntactic and does not access the file system
/// in any way.
public func isDescendant(of ancestor: AbsolutePath) -> Bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth renaming this to isSyntacticDescendant of since at a glance it looks like it's being misused in a few places where we should be considering symlinks, etc.

@rconnell9
Copy link
Contributor Author

@swift-ci test

@rconnell9
Copy link
Contributor Author

@swift-ci test windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants