One function
fnmatch_pathname_to_regex in mherrmann/gitignore_parser
The author described this change as “Fix: Directory rule matched similar files”. It counts as a record because the check below fails on the code as it stood at 8c927dd25 and passes on b3b5287e8, with nothing else changed between the two runs.
Projectmherrmann/gitignore_parser
Fix saved2023-06-30
Sharing licenceMIT · LICENSE
Change size+3 −1
What the code was meant to do, written into the code itself as a docstring
Implements fnmatch style-behavior, as though with FNM_PATHNAME flagged; the path separator will not match shell-style '*' and '.' wildcards.
The change
| 58 | 58 | res.insert(0, '(?ms)') | |
| 59 | 59 | if not directory_only: | |
| 60 | 60 | res.append('$') | |
| 61 | - | if directory_only and negation: | |
| 61 | + | elif directory_only and negation: | |
| 62 | 62 | res.append('/$') | |
| 63 | + | else: | |
| 64 | + | res.append('($|\/)') | |
| 63 | 65 | return ''.join(res) |
The check that tells the two apart
fail→pass·tests.py::Test::test_ignore_directory
Check file tests.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it8c927dd25d4848046e3b7c15d011ec88d64fc734
Broken version dated2023-02-22
Modulegitignore_parser
Units changedfnmatch_pathname_to_regex
Fingerprint45d28d057addab97
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.
Other bugs found in mherrmann/gitignore_parser
- 2024-01-19Fix ValueError for some symlinks
- 2023-10-05Fix: do not resolve symlinks
- 2023-10-04rule_from_pattern
- 2023-10-04fnmatch_pathname_to_regex
- 2023-10-03rule_from_pattern
- 2023-10-03fnmatch_pathname_to_regex