mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 19:43:47 -05:00
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:
@@ -10,10 +10,14 @@ function! gitgutter#diff#run_diff(realtime, use_external_grep, lines_of_context)
|
|||||||
if a:realtime
|
if a:realtime
|
||||||
let blob_name = ':'.gitgutter#utility#shellescape(gitgutter#utility#file_relative_to_repo_root())
|
let blob_name = ':'.gitgutter#utility#shellescape(gitgutter#utility#file_relative_to_repo_root())
|
||||||
let blob_file = tempname()
|
let blob_file = tempname()
|
||||||
let cmd .= 'git show ' . blob_name . ' > ' . blob_file .
|
let cmd .= 'git show '.blob_name.' > '.blob_file.' && '
|
||||||
\ ' && diff -U'.a:lines_of_context.' ' . g:gitgutter_diff_args . ' ' . 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
|
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
|
endif
|
||||||
|
|
||||||
if a:use_external_grep && s:grep_available
|
if a:use_external_grep && s:grep_available
|
||||||
|
|||||||
Reference in New Issue
Block a user