Are you using custom counsel settings? I'm using the defaults, which translate the input def test into the regex def.*test. You can get literal spaces by stacking multiple spaces: two spaces in a row match a single space etc.
In your input, the trailing space doesn't matter, the final regex given to the shell should be the same as for input def test.
I seem to have a related problem. I'm on Windows, with counsel-git-grep-skip-counting-lines set to its default of nil. This means counsel--git-grep-count gets initialized to 0 in counsel-git-grep. Then in counsel-git-grep-function the condition (or counsel-git-grep-skip-counting-lines (> counsel--git-grep-count 20000)) evaluates to nil meaning the (counsel-more-chars 3) check is skipped and the executed command is git --no-pager grep --full-name -n --no-color -i -e ''.
Setting counsel-git-grep-skip-counting-lines to t seems to fix the git command being executed, but then I actually get no results. Still investigating...
Thanks @abo-abo. Setting counsel-git-grep-cmd-default to "git --no-pager grep --full-name -n --no-color -i -e \"%s\"" solved my problem. Apologies for hijacking this thread when my issue turned out to be unrelated.
The following command works in command line
git --no-pager grep --full-name -n --no-color -i -e 'def test_'
But when I try to search 'def test' using counsel-git-grep, it returns nothing.
The text was updated successfully, but these errors were encountered: