fix(cli): actually use ripgrep in evo grep (fixes #94) - #100
Open
Srinivasan8888 wants to merge 1 commit into
Open
Srinivasan8888 wants to merge 1 commit into
Srinivasan8888 wants to merge 1 commit into
Conversation
The rg-availability check was `(which.exit_code or 1) == 0`. When rg is present `which rg` exits 0, but `0 or 1` -> 1 and `1 == 0` is False; when absent it's `1 or 1` -> 1, also False. The condition is False in every case, so rg was never selected and `evo grep` always fell back to `grep -rn` -- which uses a different regex dialect and does not honor .gitignore, so patterns written for rg match differently or error. Compare exit_code to 0 directly. Fixes evo-hq#94.
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.
Problem
cmd_ws_grepselects ripgrep via:which rgexits0when rg is present, but0 or 1→1, so1 == 0isFalse; when rg is absent the exit code is1→1 or 1→1, againFalse. The condition isFalsein every case, so thergbranch is dead —evo grepalways runsgrep -rn.Because
rgandgrepdiffer in regex dialect (\d,\b, lookarounds) and in.gitignorehandling, patterns intended for rg match differently or error, and ignored dirs get searched. The documented "prefer rg, fall back to grep" contract never fires.Fix
Tests
tests/unit/test_ws_grep_ripgrep.py(TDD, failing first) drivescmd_ws_grepwith a fake executor:rggrepFixes #94.