From dff7bc8736cc9bfce0e404a30a1db0373c02254f Mon Sep 17 00:00:00 2001 From: Jonathan Warner Date: Thu, 20 Feb 2014 11:26:50 +0100 Subject: [PATCH] Wrap compound commands in parentheses. This fixes a problem on Windows where non-git-tracked files caused an error in Vim instead of returning normally with a non-zero exit code. --- autoload/diff.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/autoload/diff.vim b/autoload/diff.vim index f4780de..bc8c6d3 100644 --- a/autoload/diff.vim +++ b/autoload/diff.vim @@ -4,7 +4,8 @@ let s:hunk_re = '^@@ -\(\d\+\),\?\(\d*\) +\(\d\+\),\?\(\d*\) @@' function! diff#run_diff(realtime, use_external_grep) - let cmd = 'git ls-files --error-unmatch ' . utility#shellescape(utility#file()) . ' && (' + " Wrap compound command in parentheses to make Windows happy. + let cmd = '(git ls-files --error-unmatch ' . utility#shellescape(utility#file()) . ' && (' if a:realtime let blob_name = ':' . utility#shellescape(utility#file_relative_to_repo_root()) @@ -22,7 +23,7 @@ function! diff#run_diff(realtime, use_external_grep) let cmd .= s:grep_command . ' || true' endif - let cmd .= ')' + let cmd .= '))' if a:realtime let diff = system(utility#command_in_directory_of_file(cmd), utility#buffer_contents())