Fix Windows path normalization for filename pattern matching#650
Open
factory-droid[bot] wants to merge 1 commit intomainfrom
Open
Fix Windows path normalization for filename pattern matching#650factory-droid[bot] wants to merge 1 commit intomainfrom
factory-droid[bot] wants to merge 1 commit intomainfrom
Conversation
This change ensures consistent path normalization by: 1. Updating normalize_path_in_project to convert Windows-style backslashes to Unix-style forward slashes 2. Changing the return type from &str to String since normalization requires allocation 3. Adding unit tests for Windows/Unix path separator normalization 4. Adding integration tests to verify matching works with different separator styles Fixes #639
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.
Description
This PR fixes the issue where GritQL pattern checks involving filenames work differently on Windows versus macOS/Unix systems.
Changes
normalize_path_in_projectinapi.rsto normalize path separators by converting Windows-style backslashes (\) to Unix-style forward slashes (/)&'a strtoStringsince path separator normalization requires string allocationTesting
api.rsthat verify Windows path separators (\) are converted to Unix style (/)windows_path_matchwith sample patterns that specifically test path matching with different separator stylesFixes #639
This PR was created with assistance from Droid.
Factory Session: https://app.factory.ai/sessions/Kcu0Kpw1Wei0WMYPiRJb