mpfaffenberger / mpfaffenberger/code_puppy
list_files ripgrep path still uses would_match_directory band-aid for the ignore-ancestor bug
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 814
- Forks
- 278
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 76
Description
Follow-up to #881, deliberately left out of that fix to keep its diff reviewable.
_list_files' local ripgrep path solves the same problem a third way: it writes the ignore patterns to the temp ignore file but drops any pattern that would_match_directory(pattern, directory) says would match the search root, then hands ripgrep the absolute root.
That works, but compared with the . + cwd=<root> approach now used by _grep:
- It over-prunes in the other direction. Dropping
**/tmp/**wholesale means a realtmp/directory below a root that happens to sit under/tmpis no longer ignored either. The relative-to-root approach prunes it correctly. - Three mechanisms, one problem.
_grep(cwd-relative),_list_fileslocal (pattern filter),_list_entries_via_backend/_grep_via_backend(_relative_ignore_predicates). The next person to touch ignore semantics has to find all of them.
Converting the local path to the . + cwd shape would let would_match_directory (and its tests) go away entirely, leaving exactly two mechanisms -- one per HTTP... sorry, one per traversal style: subprocess and backend-walk.
Note also: code_puppy/tools/file_operations.py is ~1493 lines, well past the 600-line guideline. The natural split is grep / list / read-edit / subprocess-plumbing. Worth doing before more is bolted onto it, but not inside a bug fix.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in code_puppy/tools/file_operations.py, comparing _list_files' local ripgrep path with _grep's existing . + cwd approach. Trace would_match_directory and its tests, then update the local listing path so ignore patterns are evaluated relative to the search root. Done means the ignore-ancestor case is handled without over-pruning nested directories and the separate pattern-filter mechanism is removed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100