-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Avoid expensive string array operations when performing isDescendent checks on AbsolutePath #9351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…checks on AbsolutePath
|
@swift-ci test |
|
@swift-ci test macOS smoke test |
|
@swift-ci test macOS |
|
@swift-ci test |
|
@swift-ci test windows |
1 similar comment
|
@swift-ci test windows |
|
@swift-ci test windows self hosted |
|
@swift-ci test windows |
| return false | ||
| } | ||
|
|
||
| if ancestorPath.hasSuffix("/") { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
|
@swift-ci test |
|
@swift-ci test windows |
Avoid expensive string array operations when performing isDescendent checks on AbsolutePath
Motivation:
#9304
Modifications:
Rely on path normalization and perform standard prefix checks.