Say I am wanting to grep the raw string ["data-foo"]
Under git bash, the following returns the expected results
git grep --fixed-strings '["data-foo"]'
However, under powershell, I cannot get any results with any of these variants:
git grep --fixed-strings '["data-foo"]';
git grep --fixed-strings "[""data-foo""]";
$s = '["data-foo"]'; git grep --fixed-strings $s;
git grep --fixed-strings '\\["data-foo"\\]';
git grep --fixed-strings '\["data-foo"\]';
My understanding is that --fixed-strings
should prevent git from attempting to parse the argument, and using single-quotes in powershell strings should prevent powershell string interpolation.
That leaves me to guess that somehow powershell is still parsing the string argument before actually handing it to the git binary, but I've been unable to determine why it would or how to properly "escape" the argument, since the raw string (e.g. $s
) is properly echoed on the powershell console.
(Last tested with git version 2.39.2.windows.1
)