Conversation
This branch has not been deployed
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.
Summary
Gitignore patterns ending in a TAB or a non-ASCII space currently match the filename without that character and miss the literal filename. For example,
GitIgnoreSpec.from_lines(['example\t'], backend='simple')ignoresexamplerather thanexample\t. This reproduces with the official 1.1.1 wheel and current master; Git 2.52.0 retains the TAB.The released parser uses a broad
rstrip()and master's_strip_trailing_ws()usesstr.isspace(). Both can also truncate UTF-8 NBSP bytes: the patternb'mark\xc2\xa0\n'misses the full name and matchesb'mark\xc2'instead.Limit the existing scan to spaces and CR/LF, retaining literal TAB, vertical tab, form feed, NEL, NBSP, and EM SPACE characters. Backslash parity and existing CR/LF handling are preserved. This does not attempt to fix the separate existing CR/LF edge cases.
Validation
python -m unittest discover -t . -s tests/: 230 passed, 385 skipped subtests. Optional RE2/Hyperscan backends were not installed or testedmypy pathspec tests/check_usage.pyandpyright pathspec tests/check_usage.pyreport the same 9 and 8 diagnostics, respectively, before and after the patch. These concern missing optional backends and existing_typing.pyissues; no new diagnostic was introducedgit diff --checkpassThe commands were executed in an isolated CPython 3.12.14 environment using official PyPI wheels, with Git 2.52.0 as the matching oracle.
AI assistance: the patch and tests were prepared with an OpenAI assistant. All reported verification was actually executed, and another AI assistant independently reviewed and reran the relevant tests and Git comparisons. This does not represent human review.