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.

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

5858 res.insert(0, '(?ms)')
5959 if not directory_only:
6060 res.append('$')
61- if directory_only and negation:
61+ elif directory_only and negation:
6262 res.append('/$')
63+ else:
64+ res.append('($|\/)')
6365 return ''.join(res)

The check that tells the two apart

failpass·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