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.
Projectmherrmann/gitignore_parser
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
| 21 | 21 | for line in ignore_file: | |
| 22 | 22 | counter += 1 | |
| 23 | 23 | 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), | |
| 25 | 25 | source=(full_path, counter)) | |
| 26 | 26 | if rule: | |
| 27 | 27 | rules.append(rule) | |
| ⋯ | |||
| 41 | 41 | Because git allows for nested .gitignore files, a base_path value | |
| 42 | 42 | is required for correct behavior. The base path should be absolute. | |
| 43 | 43 | """ | |
| 44 | - | if base_path and base_path != Path(base_path).resolve(): | |
| 45 | - | raise ValueError('base_path must be absolute') | |
| 46 | 44 | # Store the exact pattern for our repr and string functions | |
| 47 | 45 | orig_pattern = pattern | |
| 48 | 46 | # Early returns follow | |
The check that tells the two apart
fail→pass·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
- 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
- 2023-06-30fnmatch_pathname_to_regex