Subject: bug#35326: 26.1; vc-git-grep should pass -i like isearch

From: Lars Ingebrigtsen <[email-masked]>
Date: Sun, 23 Jun 2019 21:02:32 +0200

Antoine Beaupré <[email-masked]> writes:

> M-x load-library vc
> M-x load-library vc-git
> M-x vc-git-grep
>
> The resulting git grep command is:
>
> git --no-pager grep -n -e foo -- \* .\[\!.\]\* ..\?\*
>
> I believe it should be rather:
>
> git --no-pager grep -n -i -e foo -- \* .\[\!.\]\* ..\?\*
>
> ... that is, it should be case insensitive unless there are capital
> letters in the search string. This is how isearch and regular M-x grep
> both work.

Hm...  The default grep command on my machine (Debian GNU/Linux stretch)
is "grep --color -nH --null -e", so it is case sensitive.

Oh, lgrep does add the -i parameter:

grep  --exclude=.\#\* --exclude=\*.o --exclude=\*\~ --exclude=\*.bin --exclude=\*.lbin --exclude=\*.so --exclude=\*.a --exclude=\*.ln --exclude=\*.blg --exclude=\*.bbl --exclude=\*.elc --exclude=\*.lof --exclude=\*.glo --exclude=\*.idx --exclude=\*.lot --exclude=\*.fmt --exclude=\*.tfm --exclude=\*.class --exclude=\*.fas --exclude=\*.lib --exclude=\*.mem --exclude=\*.x86f --exclude=\*.sparcf --exclude=\*.dfsl --exclude=\*.pfsl --exclude=\*.d64fsl --exclude=\*.p64fsl --exclude=\*.lx64fsl --exclude=\*.lx32fsl --exclude=\*.dx64fsl --exclude=\*.dx32fsl --exclude=\*.fx64fsl --exclude=\*.fx32fsl --exclude=\*.sx64fsl --exclude=\*.sx32fsl --exclude=\*.wx64fsl --exclude=\*.wx32fsl --exclude=\*.fasl --exclude=\*.ufsl --exclude=\*.fsl --exclude=\*.dxl --exclude=\*.lo --exclude=\*.la --exclude=\*.gmo --exclude=\*.mo --exclude=\*.toc --exclude=\*.aux --exclude=\*.cp --exclude=\*.fn --exclude=\*.ky --exclude=\*.pg --exclude=\*.tp --exclude=\*.vr --exclude=\*.cps --exclude=\*.fns --exclude=\*.kys --exclude=\*.pgs --exclude=\*.tps --exclude=\*.vrs --exclude=\*.pyc --exclude=\*.pyo --color -i -nH --null -e compile-goto-error *.el

Confusing.

> The reason this doesn't work with vc-git-grep is because the
> default value of the template doesn't include the <C> pattern.

[...]

> Obviously, it's also possible for users to customize that variable
> themselves and add that string, but it's less than obvious they can do
> so because the help string doesn't document that magic escape sequence,
> nor does it document the *other* escape sequences supported by
> grep-expand-template (which is also probably a bug).

Yes, the doc string should contain all the possible expansions, but I'm
not sure whether it should default to having <C>, since grep and lgrep
default do different things.  And does git grep support --color, which
will apparently also be inserted if you have <C>?

 <C> - place to put the options like -i and --color.

Weird system.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no