mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-10 04:23:46 -05:00
Remove unnecessary shell redirection.
While it is aesthetically nicer to discard the unused output from `git ls-files`, it isn't necessary. Discarding requires a shell redirection which exposes us to vim's shell quirks; it's not worth it.
This commit is contained in:
@@ -4,7 +4,7 @@ let s:hunk_re = '^@@ -\(\d\+\),\?\(\d*\) +\(\d\+\),\?\(\d*\) @@'
|
|||||||
|
|
||||||
|
|
||||||
function! diff#run_diff(realtime, use_external_grep)
|
function! diff#run_diff(realtime, use_external_grep)
|
||||||
let cmd = 'git ls-files --error-unmatch' . utility#discard_stdout_and_stderr() . ' ' . shellescape(utility#file()) . ' && ('
|
let cmd = 'git ls-files --error-unmatch ' . shellescape(utility#file()) . ' && ('
|
||||||
|
|
||||||
if a:realtime
|
if a:realtime
|
||||||
let blob_name = ':./' . fnamemodify(utility#file(),':t')
|
let blob_name = ':./' . fnamemodify(utility#file(),':t')
|
||||||
|
|||||||
@@ -59,17 +59,6 @@ function! utility#escape(str)
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! utility#discard_stdout_and_stderr()
|
|
||||||
if !exists('utility#discard')
|
|
||||||
if &shellredir ==? '>%s 2>&1'
|
|
||||||
let utility#discard = ' > /dev/null 2>&1'
|
|
||||||
else
|
|
||||||
let utility#discard = ' >& /dev/null'
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
return utility#discard
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! utility#command_in_directory_of_file(cmd)
|
function! utility#command_in_directory_of_file(cmd)
|
||||||
let utility#cmd_in_dir = 'cd ' . utility#directory_of_file() . ' && ' . a:cmd
|
let utility#cmd_in_dir = 'cd ' . utility#directory_of_file() . ' && ' . a:cmd
|
||||||
return substitute(utility#cmd_in_dir, "'", '"', 'g')
|
return substitute(utility#cmd_in_dir, "'", '"', 'g')
|
||||||
|
|||||||
Reference in New Issue
Block a user