Repository navigation
[Windows] keep the drive letter when computing a common parent directory - #10565
Open
charles-zablit wants to merge 1 commit into
Open
charles-zablit wants to merge 1 commit into
charles-zablit wants to merge 1 commit into
Conversation
charles-zablit
requested review from
bkhouri,
bripeticca,
cmcgee1024,
daveinglis,
daveyc123,
dschaefer2,
jakepetroules,
owenv,
plemarquand and
rconnell9
as code owners
September 21, 2026 14:08
Contributor
Author
|
@swift-ci please test |
charles-zablit
force-pushed
the
cz/windows/common-parent-drive-root
branch
from
September 21, 2026 14:16
ecdddbf to
805fbc9
Compare
Contributor
Author
|
@swift-ci please test |
Contributor
|
@swift-ci please test macOS |
Contributor
|
@swift-ci test windows |
Contributor
|
@swift-ci test self hosted windows |
Contributor
Author
|
@swift-ci please test windows |
dschaefer2
reviewed
Oct 5, 2026
| (id: "drive_root_and_child", paths: [#"C:\"#, #"C:\swiftpm"#], expected: #"C:\"#), | ||
| (id: "drive_nested_common", paths: [#"C:\a\b\c"#, #"C:\a\b\d"#], expected: #"C:\a\b"#), | ||
| (id: "drive_single_path", paths: [#"C:\a\b"#], expected: #"C:\a\b"#), | ||
| (id: "different_drives", paths: [#"C:\a"#, #"D:\a"#], expected: #"C:\"#), |
Member
There was a problem hiding this comment.
I'm surprised by this one. I'm not sure what value returning one of the drives is. That doesn't sound like this would work in practice. I wonder if it makes more sense to return nil in this case. i.e., there is no common parent directory and client code has to deal with that possibility.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Keep the drive letter when computing a common parent directory on Windows
Motivation:
getCommonParentDirectorysplits paths into components and rebuilds the result by joining on"/". That cannot express a Windows root, so the common parent ofC:\swift-syntaxandC:\llbuildcomes back asC:instead ofC:\. This causes tests failures on Windows in the rebranch.Modifications:
Walk up from the first path with
parentDirectoryuntil it is an ancestor of the rest, instead of decomposing and reassembling.Result:
Drive roots survive, and distinct drives now terminate at a root rather than falling through to
/. POSIX behaviour is unchanged.