mpfaffenberger / mpfaffenberger/code_puppy

list_files ripgrep path still uses would_match_directory band-aid for the ignore-ancestor bug

Open
#882 0 comments 0 reactions 0 assignees View on GitHub

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:

  1. It over-prunes in the other direction. Dropping **/tmp/** wholesale means a real tmp/ directory below a root that happens to sit under /tmp is no longer ignored either. The relative-to-root approach prunes it correctly.
  2. Three mechanisms, one problem. _grep (cwd-relative), _list_files local (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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.