Skip to content

Fix relative path matching for nested ignore files on Windows#1216

Closed
somiljain2006 wants to merge 4 commits into
swiftlang:mainfrom
somiljain2006:File-iterator-issue
Closed

Fix relative path matching for nested ignore files on Windows#1216
somiljain2006 wants to merge 4 commits into
swiftlang:mainfrom
somiljain2006:File-iterator-issue

Conversation

@somiljain2006

Copy link
Copy Markdown

Resolves #1192

Improve path handling for nested .swift-format-ignore evaluation on Windows.

This change updates IgnoreManager.getRelativePath(from:to:) to make path matching more robust across platforms:

  • Perform case-insensitive path comparisons on Windows.
  • Enforce directory-boundary checks when determining whether a file is contained within an ignore file's directory hierarchy, preventing false matches such as Sources matching SourcesTests.
  • Normalize relative paths to use POSIX-style forward slashes before evaluating GitIgnorePatterns.

With these changes, fileIteratorWithMultipleNonEmptySwiftIgoreFiles passes without the withKnownIssue workaround, so the wrapper has been removed.

Windows CI will provide final validation that this addresses the reported failure.

@somiljain2006

Copy link
Copy Markdown
Author

@allevato Can you review this pr?

@somiljain2006

Copy link
Copy Markdown
Author

The current approach doesn't appear to address the Windows failure, so I'm going to investigate this from a different angle. I'll reproduce and debug the issue on a local Windows environment to better understand the path and ignore-rule behavior before proposing another fix.

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.

Remove withKnownIssue in the fileIteratorWithMultipleNonEmptySwiftIgoreFiles test

1 participant