One function

fnmatch_pathname_to_regex in mherrmann/gitignore_parser

The author described this change as Fix pattern with slash in range (#55). It counts as a record because the check below fails on the code as it stood at ffbfd79ab and passes on d45a08589, with nothing else changed between the two runs.

Fix saved2023-10-03
Sharing licenceMIT · LICENSE
Change size+1 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

4444 if j >= n:
4545 res.append('\\[')
4646 else:
47- stuff = pattern[i:j].replace('\\', '\\\\')
47+ stuff = pattern[i:j].replace('\\', '\\\\').replace('/', '')
4848 i = j + 1
4949 if stuff[0] == '!':
5050 stuff = ''.join(['^', stuff[1:]])

The check that tells the two apart

failpass·tests.py::Test::test_slash_in_range_does_not_match_dirs

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 itffbfd79ab4b96f88cd78322a91b6809ba8d97173
Broken version dated2023-08-15
Modulegitignore_parser
Units changedfnmatch_pathname_to_regex
Fingerprint4492b68b920e0e12
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