tpope/vim-fugitive — pull request #254 by guns (2012-09-21 18:11:20+00:00)
Title: Fix Vim filename escaping for StageDiff + more

In addition to these bugs (now fixed), Fugitive still can't handle
filenames that show up as quoted in git status:

a"b.txt a\b.txt a❤b.txt

git status shows these files as:

#	"a\"b.txt"
#	"a\\b.txt"
#	"a\342\235\244b.txt"

and fugitive breaks because it doesn't strip the surrounding quotes.
I don't have time to fix this today, but I'll come back to it if it
annoys me in the future.

~~~

* Filename arguments to Gedit should not be escaped, as s:Edit already
s:fnameescape()s when passing filenames to the next command.

Fixes:

A filename with a Vim metacharacter in the Gstatus window cannot be
diffed via StageDiff because it becomes double escaped:

#	modified: etc/%mutt/muttrc

Pressing 'D' on this line opens two new buffers:

t/muttrc (filename shifted by length of repo().dir())
etc/\%mutt/muttrc (one actual backslash)

* s:shellesc should pass an optional {special} argument to
shellescape() when it is used to sanitize filenames for Vim functions
and not direct system calls. Vim commands will do one more pass over
the filename and erroneously expand metacharacters like '%'

Fixes:

#	modified: etc/%mutt/muttrc

This same file cannot be processed correctly by s:StagePatch or
s:StageDiffEdit. Pressing 'p' on this line results in "No
changes." from git, and pressing 'dp' results in:

fatal: ambiguous argument 'etc/README.markdownmutt/muttrc' ...

Where README.markdown is the current active buffer, replacing
the '%' in the filename.