Replies: 1 comment 2 replies
-
Couldn't we quite easily detect if a pathspec is present and then construct the command line differently? Or would this break other things or maybe it is not robust? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary and extracts of the discussion at: https://www.reddit.com/r/emacs/comments/1crl9tr/consultgitgrep_doesnt_honor_pathspec/
Currently, the way
consult--git-grep-make-builder
constructs the command, it appends paths to-be-searched to end end of it.This interferes with the user-provided
pathspec
which filters what files should be matched.For example:
#hello -- -- :*.txt
turns intogit grep "hello" -- :*.txt .
, notice the.
at the end.The work-around is to pass nil as the paths.
The only downside AFIK is that you will not be able to specify multiple worktrees to do the git-grep on. But for those use-cases, I guess they can be somewhat covered with a
consult-grep
.Chances are, if you want this
consult-git-grep
workaround, then you might want to be aware ofconsult-grep
s--include
behaviour:(setq grep-find-ignored-files nil)
in order forgrep
to have the more expected--include
behavoiur.Beta Was this translation helpful? Give feedback.
All reactions