simplify git detection
This commit is contained in:
parent
8cf6c61795
commit
aefd88057e
@ -226,16 +226,11 @@ function! s:diff_get(path) abort
|
|||||||
|
|
||||||
if executable('git')
|
if executable('git')
|
||||||
let orig_dir = getcwd()
|
let orig_dir = getcwd()
|
||||||
let wt = fnamemodify(a:path, ':h')
|
exe 'cd '. fnamemodify(a:path, ':h')
|
||||||
exe 'cd '. wt
|
let diff = system('git diff --no-ext-diff -U0 -- '. a:path .' | grep "^@@ "')
|
||||||
let gd = system('git rev-parse --git-dir')[:-2] " remove newline
|
|
||||||
if !v:shell_error
|
if !v:shell_error
|
||||||
let wt = fnamemodify(gd, ':h')
|
exe 'cd '. orig_dir
|
||||||
let diff = system('git --work-tree '. wt .' --git-dir '. gd .' diff --no-ext-diff -U0 -- '. a:path .' | grep "^@@ "')
|
return diff
|
||||||
if !v:shell_error
|
|
||||||
exe 'cd '. orig_dir
|
|
||||||
return diff
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
exe 'cd '. orig_dir
|
exe 'cd '. orig_dir
|
||||||
endif
|
endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user