Whole file

mherrmann/gitignore_parser

The author described this change as Fix ValueError for some symlinks. It counts as a record because the check below fails on the code as it stood at 6c8bd4469 and passes on 3861152b5, with nothing else changed between the two runs.

Fix saved2024-01-19
Sharing licenceMIT · LICENSE
Change size+1 3

What the code was meant to do, written into the code itself as a save note

Fix ValueError for some symlinks

The change

2121 for line in ignore_file:
2222 counter += 1
2323 line = line.rstrip('\n')
24- rule = rule_from_pattern(line, base_path=Path(base_dir).resolve(),
24+ rule = rule_from_pattern(line, base_path=_normalize_path(base_dir),
2525 source=(full_path, counter))
2626 if rule:
2727 rules.append(rule)
4141 Because git allows for nested .gitignore files, a base_path value
4242 is required for correct behavior. The base path should be absolute.
4343 """
44- if base_path and base_path != Path(base_path).resolve():
45- raise ValueError('base_path must be absolute')
4644 # Store the exact pattern for our repr and string functions
4745 orig_pattern = pattern
4846 # Early returns follow

The check that tells the two apart

failpass·tests.py::Test::test_symlink_to_symlink_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 it6c8bd44695546269b0d1f8f41819fe480baea954
Broken version dated2024-01-10
Modulegitignore_parser
Units changedparse_gitignore, rule_from_pattern
Fingerprint1a26ee0b3bc041b2
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