Skip to content

fix: preserve inverted gitignore traversal - #239

Merged
georgeh0 merged 1 commit into
cocoindex-io:mainfrom
shixi-li:fix/inverted-gitignore
Jul 30, 2026
Merged

fix: preserve inverted gitignore traversal#239
georgeh0 merged 1 commit into
cocoindex-io:mainfrom
shixi-li:fix/inverted-gitignore

Conversation

@shixi-li

Copy link
Copy Markdown
Contributor

Fixes #225.

Summary

Inverted .gitignore files that start with * and reopen directories with !*/ are pruned under pathspec 1.x, so source files below those directories never reach the matcher.

  • constrain pathspec to the last compatible 0.x line and refresh uv.lock
  • add a real tree-walk regression for root and nested C/C++ source files
  • verify ordinary ignored files and later Content/ exclusions remain excluded

The dependency bound is intentional: GitIgnoreSpec in pathspec 1.0.4 and 1.1.1 marks the reopened directories ignored, while 0.12.1 matches Git for this pattern. Using plain PathSpec is not equivalent because it changes file-ignore behavior.

Testing

  • uv run pytest tests/test_file_walk.py -v
  • uv run mypy src/ tests/
  • uv run prek run --all-files --verbose --show-diff-on-failure --skip pytest
  • uv run pytest tests/ -v (270 passed, 8 deselected)

@badmonster0
badmonster0 requested a review from georgeh0 July 30, 2026 05:18
@badmonster0

Copy link
Copy Markdown
Member

thanks a lot for the PR! @georgeh0 can help take a look!

@georgeh0 georgeh0 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@georgeh0
georgeh0 merged commit beba2cf into cocoindex-io:main Jul 30, 2026
4 checks passed
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.

Does support iverted .gitignore

3 participants