Skip to content

Commit

Permalink
Better escaping in :DiffGitCached
Browse files Browse the repository at this point in the history
  • Loading branch information
tpope committed Jun 4, 2008
1 parent e360bc0 commit 57d41fa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ftplugin/gitcommit.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin
" Language: git config file
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
" Last Change: 2008 Mar 09
" Last Change: 2008 Jun 04

" Only do this when not done yet for this buffer
if (exists("b:did_ftplugin"))
Expand Down Expand Up @@ -54,12 +54,12 @@ function! s:gitdiffcached(bang,gitdir,...)
let git .= " --git-dir=".(exists("*shellescape") ? shellescape(a:gitdir) : '"'.a:gitdir.'"')
endif
if a:0
let extra = join(map(copy(a:000),has("*shellescape") ? 'shellescape(v:val)' : "'\"'.v:val.'\"'"))
let extra = join(map(copy(a:000),exists("*shellescape") ? 'shellescape(v:val)' : "'\"'.v:val.'\"'"))
else
let extra = "-p --stat=".&columns
endif
call system(git." diff --cached --no-color ".extra." > ".name)
exe "pedit ".name
call system(git." diff --cached --no-color ".extra." > ".(exists("*shellescape") ? shellescape(name) : name))
exe "pedit ".(exists("*fnameescape") ? fnameescape(name) : name)
wincmd P
let b:git_dir = a:gitdir
command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>)
Expand Down

0 comments on commit 57d41fa

Please sign in to comment.