Skip to content

Normalize redundant interior components in matching paths - #179

Merged
cpburnz merged 3 commits into
cpburnz:masterfrom
mayankdhingra02:fix/redundant-interior-path-components
Nov 8, 2026
Merged

cpburnz merged 3 commits into
cpburnz:masterfrom
mayankdhingra02:fix/redundant-interior-path-components

Conversation

@mayankdhingra02

Copy link
Copy Markdown
Contributor

Fixes #176.

An anchored rule such as /data/private.txt misses data//private.txt and data/./private.txt, although Git recognizes all three paths as the same ignored file. Normalize redundant interior components before matching, preserving parent components, trailing directory markers and the original input values returned by the matching APIs.

The regression coverage exercises PathSpec and GitIgnoreSpec, positive and negated rules, batch and single-file results, custom separators and literal backslashes. Related #173 addresses repeated leading ./ prefixes.

Validation on macOS ARM64:

  • Full project unittest suites pass on Python 3.9.25 and 3.14.8: 299 test methods. All three backends (simple, RE2 and Hyperscan) run on 3.14, with one existing platform skip. Optional-backend subtests are skipped on 3.9.
  • The new module fails on unchanged source and passes with the fix. Real filesystem aliases agree with git check-ignore; independent review also checked all three backends.
  • Strict Sphinx HTML, mypy, pyright, wheel/sdist builds and Twine checks pass. Archive contents and installed-wheel behavior pass on both Python versions.

Other Python/OS combinations remain for CI. The changelog source is updated; generated distribution documents were verified during the project's prebuild step.

mayankdhingra02 and others added 3 commits November 1, 2026 16:46
Match equivalent relative paths consistently while preserving parent components, directory markers and original input values in results. Add public matching API regressions and update the source changelog.

Fixes cpburnz#176.

Signed-off-by: Mayank Dhingra <mayankdhingra02@gmail.com>
@cpburnz

cpburnz commented Nov 8, 2026

Copy link
Copy Markdown
Owner

Thanks for finding and fixing this!

@cpburnz
cpburnz merged commit bd40e69 into cpburnz:master Nov 8, 2026
cpburnz added a commit that referenced this pull request Nov 8, 2026
cpburnz added a commit that referenced this pull request Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GitIgnoreSpec misses anchored rules for redundant interior path separators

2 participants