Skip to content

fix(cli): actually use ripgrep in evo grep (fixes #94) - #100

Open
Srinivasan8888 wants to merge 1 commit into
evo-hq:mainfrom
Srinivasan8888:fix/issue-94-ripgrep
Open

Srinivasan8888 wants to merge 1 commit into
evo-hq:mainfrom
Srinivasan8888:fix/issue-94-ripgrep

Conversation

@Srinivasan8888

Copy link
Copy Markdown

Problem

cmd_ws_grep selects ripgrep via:

if (which.exit_code or 1) == 0 and which.stdout.strip():

which rg exits 0 when rg is present, but 0 or 11, so 1 == 0 is False; when rg is absent the exit code is 11 or 11, again False. The condition is False in every case, so the rg branch is dead — evo grep always runs grep -rn.

Because rg and grep differ in regex dialect (\d, \b, lookarounds) and in .gitignore handling, 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

if which.exit_code == 0 and which.stdout.strip():

Tests

tests/unit/test_ws_grep_ripgrep.py (TDD, failing first) drives cmd_ws_grep with a fake executor:

  • rg present → the search command is rg
  • rg absent → falls back to grep

Fixes #94.

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.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

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.

evo grep never uses ripgrep — availability check is inverted, always falls back to grep

1 participant