GNU bug report logs -
#39452
[PATCH] vc-git-state fails for filenames with wildcards
Previous Next
Reported by: Wolfgang Scherer <Wolfgang.Scherer <at> gmx.de>
Date: Thu, 6 Feb 2020 14:00:02 UTC
Severity: normal
Tags: patch
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #29 received at 39452 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Am 07.02.20 um 18:25 schrieb Wolfgang Scherer:
> Hi Dmitry,
>
> Am 07.02.20 um 00:00 schrieb Dmitry Gutov:
>> On 06.02.2020 16:59, Wolfgang Scherer wrote:
>>> When a filename contains shell wildcard characters matching one or more files, e.g. `test[56].xx` matching both `test5.xx` and `test6.xx`:
>>> The command `vc-git-state` does not work correctly.
>>>
>>> The attched patch fixes this:
>>>
>>> - (status (apply #'vc-git--run-command-string file args)))
>>> + (status (apply #'vc-git--run-command-string (shell-quote-argument file) args)))
>>>
>> Thanks for the report and the patch.
>>
>> I wonder how many other backends commands are broken for files like that: we basically never shell-quote file names.
After some research, it seems that adding a pathspec magic to commands that support this feature is the best solution.
Here is a patch that applies vc-git--literal-pathspec, vc-git--literal-pathspecs to some git commands in vc-git.el. I have tested all augmented commands in the shell and some in emacs.
(defun vc-git--literal-pathspec-inner (pathspec)
"Prepend :(literal) path magic to PATHSPEC."
(concat ":(literal)" pathspec))
(defun vc-git--literal-pathspec (pathspec)
"Prepend :(literal) path magic to PATHSPEC."
(and pathspec (vc-git--literal-pathspec-inner pathspec)))
(defun vc-git--literal-pathspecs (pathspecs)
"Prepend :(literal) path magic to PATHSPECS."
(mapcar #'vc-git--literal-pathspec-inner pathspecs))
[0001-vc-git-state-fails-for-filenames-with-wildcards.patch (text/x-patch, attachment)]
This bug report was last modified 3 years and 314 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.