Make realtime diff use git-diff.

The only reason the realtime diff used `diff` instead of `git-diff`
previously was that I couldn't figure out how to do it in a way that
worked on Windows as well as Unix.
This commit is contained in:
Andy Stewart
2014-11-11 10:14:38 +01:00
parent 39f0119096
commit b0e9efa11c

View File

@@ -10,10 +10,14 @@ function! gitgutter#diff#run_diff(realtime, use_external_grep, lines_of_context)
if a:realtime
let blob_name = ':'.gitgutter#utility#shellescape(gitgutter#utility#file_relative_to_repo_root())
let blob_file = tempname()
let cmd .= 'git show ' . blob_name . ' > ' . blob_file .
\ ' && diff -U'.a:lines_of_context.' ' . g:gitgutter_diff_args . ' ' . blob_file . ' - '
let cmd .= 'git show '.blob_name.' > '.blob_file.' && '
endif
let cmd .= 'git diff --no-ext-diff --no-color -U'.a:lines_of_context.' '.g:gitgutter_diff_args.' '
if a:realtime
let cmd .= '-- '.blob_file.' - '
else
let cmd .= 'git diff --no-ext-diff --no-color -U'.a:lines_of_context.' ' . g:gitgutter_diff_args . ' ' . gitgutter#utility#shellescape(gitgutter#utility#filename())
let cmd .= gitgutter#utility#shellescape(gitgutter#utility#filename())
endif
if a:use_external_grep && s:grep_available