-
Notifications
You must be signed in to change notification settings - Fork 12
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
Fix git ls-file
parsing in iter_gitworktree()
#421
Conversation
This commit changes the regular expression that analyses git output in such a way, that it only consumes a single tab character before the file name. That change makes it work with file names that start with a tab-character.
a6822fd
to
938e29c
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #421 +/- ##
==========================================
- Coverage 92.06% 92.01% -0.05%
==========================================
Files 122 122
Lines 9020 9033 +13
==========================================
+ Hits 8304 8312 +8
- Misses 716 721 +5
☔ View full report in Codecov by Sentry. |
baa144e
to
fc2fcd5
Compare
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.
Thanks. This looks good to me in general. However, the test conditions needs to be adjusted. This is not about windows, but about whether the FS can handle such filenames at all -- see the crippled FS test failures.
This commit adds a regression test to ensure that file-names starting with a tab-character are properly parsed from the output of `git ls-files`. The test instantiates PurePosixPath-instances to check against names in the output of `iter_gitworktree`, because `iter_gitworktree` explicitly creates PurePosixPath-instances in the function `_lsfiles_line2props`.
fc2fcd5
to
d1e9efe
Compare
Crippled-FS conditions fixed now by using:
|
87c3c4e
to
bec45ae
Compare
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.
LGTM! Thx!
This PR modifies the regular expression that is used during execution of
iter_gitworktree()
in order to parse the output ofgit ls-tree
.The current version ensures that only one tab-character is considered to separate the file info from the file name. That ensures that file names that start with tab-characters are properly handled (the previous version, would consider all tab-characters, including the tab-characters belonging to the name, as file-info/file-name separator).
The PR includes a regression test that verifies correct handling of file names starting with tab-characters