Subject: bug#39452: [PATCH] vc-git-state fails for filenames with wildcards

From: Noam Postavsky <[email-masked]>
Date: Wed, 12 Feb 2020 10:24:28 -0500

Dmitry Gutov <[email-masked]> writes:

> On 07.02.2020 16:43, Noam Postavsky wrote:
>> Dmitry Gutov <[email-masked]> writes:
>>
>>> It's not so simple. FILE already goes through call-process. But Git
>>> expects a pathspec, not just a file name. So if it's a glob, it is
>>> expanded.
>>
>> You can pass --literal-pathspecs to tell git not to expand.  Magit does
>> this.  But there is a downside due to the way git implements it, which
>> is by setting an environment variable: it affects all subprocesses git
>> calls, including git-hook scripts which tends to trip people up.
>
> I wonder how bad the latter problem is.  After all, even if it
> happens, it *can* be worked around in the same scripts.

Yes, it's common enough to have a FAQ for it.
https://magit.vc/manual/magit/My-Git-hooks-work-on-the-command_002dline-but-not-inside-Magit.html