Skip to content

fix: rtk find returns empty results after git init (#2589) - #2598

Closed
Saerdna wants to merge 2 commits into
rtk-ai:developfrom
Saerdna:fix/issue-2589-find-after-git-init
Closed

Saerdna wants to merge 2 commits into
rtk-ai:developfrom
Saerdna:fix/issue-2589-find-after-git-init

Conversation

@Saerdna

@Saerdna Saerdna commented Jun 25, 2026

Copy link
Copy Markdown

Summary

  • Fix rtk find returning empty results after git init (Bug: rtk find stops working after git init #2589)
  • Disable gitignore filtering (git_ignore/git_global/git_exclude) in WalkBuilder so rtk find matches native find behavior
  • Add regression test covering find in both non-git and git-initialized directories

Test plan

  • cargo clippy --all-targets && cargo test — 30/30 find_cmd tests pass, clippy clean
  • Manual testing: rtk find . -name "message.csv" returns correct results in git-initialized directory with global gitignore *.csv rule

Disable gitignore filtering in WalkBuilder so rtk find matches native
find behavior. Previously git_ignore/git_global/git_exclude were all
true, causing the ignore crate to respect .gitignore, global gitignore,
and .git/info/exclude rules. This incorrectly filtered out files that
are untracked or matched by global gitignore patterns (e.g. *.csv).

Root cause: ignore::WalkBuilder with git_global(true) reads the user's
global gitignore (e.g. ~/.config/git/ignore) and filters matching
files, even when no local .gitignore rule applies.

Regression test added: find_works_after_git_init creates a temp dir,
verifies find works before and after git init.
@CLAassistant

CLAassistant commented Jun 25, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@Saerdna

Saerdna commented Jul 3, 2026

Copy link
Copy Markdown
Author

Requesting review when convenient. This is a small behavior fix for rtk find to match native find, with a regression test included.

…ind-after-git-init

Resolve the find_cmd.rs conflicts in favor of upstream's disclosure
architecture (gitignore-aware walk + disclosure of hidden/ignored
matches, from the 0.46.0 find rewrite): rtk find no longer silently
drops ignored files -- matches collected by the ignore rules are
disclosed in the output, which addresses the user-visible symptom
of rtk-ai#2589.

Drop the original git_global(false) approach from this branch: it
predates the upstream find rewrite and would revert the released
disclosure behavior (breaking
hidden_and_ignored_matches_are_collected_for_disclosure).

Keep the rtk-ai#2589 regression test, strengthened:
find_works_after_git_init now drives native_walk directly and asserts
that a gitignored *.csv match is collected for disclosure after
`git init` (the original test only checked is_ok(), which passed
even with the bug present).
@KuSh

KuSh commented Sep 19, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the regression test and for chasing this down. The underlying problem was fixed by #3854, merged on 2026-09-03, which keeps gitignore filtering but discloses hidden and ignored matches instead of dropping them silently, and develop already carries an equivalent test (hidden_and_ignored_matches_are_collected_for_disclosure in src/cmds/system/find_cmd.rs). Running the reporter's case on current develop, rtk find ./ -name message.csv in a repo that ignores *.csv now reports the filtered match and the recovery log rather than an empty result, so this PR's test is covered. Closing as already handled, but please comment or reopen if you see a case it still misses.

@KuSh KuSh closed this Sep 19, 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.

3 participants