Repository navigation
Conversation
📊 Automated PR Analysis
SummaryFixes native Review Checklist
Linked issues: #4244 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
`.gitignore` never applies to tracked files, but the ignore-crate walker cannot see git's index, so a file force-added (`git add -f`) inside an ignored directory was pruned along with that directory and silently missing from `rtk find` results. After the walk, ask git for tracked files matching ignore rules and add those that match the pattern, honoring max depth and the hidden-entry rule. Fixes rtk-ai#4244 Co-Authored-By: Claude Opus 5.5 <[email protected]>
BeeKnown
force-pushed
the
fix/find-force-tracked-ignored
branch
from
September 26, 2026 00:44
ff1a76e to
8cdfa7c
Compare
Author
|
Hi, following up on this PR. The CI workflow expired while waiting for approval, so no CI jobs ran. Could a maintainer take a look and let me know whether the checks can be restarted? Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #2995 (force-tracked subcase)
Summary
.gitignorenever applies to tracked files, but theignore-crate walker innative_walkcan't see git's index, so a file force-added (git add -f) inside an ignored directory was pruned along with that directory and silently missing fromrtk findresults.native_walknow runsgit ls-files -z --cached --ignored --exclude-standard(only tracked files that match ignore rules, so the output stays small) and adds entries that match the pattern and weren't already found. It honorsmax_depthand the hidden-entry rule, and skips deleted-but-tracked files and submodule gitlinks. It does nothing outside a git repo or whengitfails.(N filtered)tee log still lists ignored directory names rather than the paths inside them (the second half of rtk find -iname silently drops matches inside a gitignored-but-tracked directory #4244). With this fix, the issue's repro still reportsdata/as filtered, because the directory holds an untracked file, which is correct.Test plan
cargo fmt --all --check: clean.cargo clippy --all-targets: no warnings.cargo test --no-fail-fast: 3968 passed, 2 failed. Both failures (guard_integration_test::git_diff_dash_dash_stat_pathspec_after_double_dash_is_not_stat_flagandgit_log_malformed_digit_run_propagates_real_git_error) also fail on unmodifieddevelop@f3d4d9bon this machine (macOS, git 2.39.5 Apple Git-154), so they aren't caused by this change.force_tracked_files_under_ignored_dirs_are_found, which covers a case-insensitive match, excluding untracked files in the ignored dir,max_depth, and-type d. It fails without the fix (left: ["src/target.py"]) and passes with it.data/subdir/target.pyandsrc/target.py, the same asrtk proxy find. On a real repo that gitignoresdata/and force-tracks scripts inside it,find . -iname '*.py'went from 32 to 53 files. The 21 extra files are exactly the tracked-but-ignored.pyfilesgit ls-files -ci --exclude-standardreports.Performance note
This adds one
gitsubprocess per nativertk find. Measured on macOS (release build, 20 runs, a 377-file repo): about 30 ms to 40 ms per invocation, so about 10 ms added. If that's too much for the startup budget, the call could be gated, for example to run only when the walk actually pruned something because of an ignore rule. That's your call.🤖 Generated with Claude Code