Fix vim git blame not showing uncommitted changes
This commit is contained in:
parent
0f2d8b26e1
commit
f17f7da524
1 changed files with 6 additions and 4 deletions
|
@ -186,18 +186,20 @@ function! s:git_blame(first, last)
|
||||||
let l:revision = b:git_revision_hash
|
let l:revision = b:git_revision_hash
|
||||||
let l:name = b:git_original_file
|
let l:name = b:git_original_file
|
||||||
else
|
else
|
||||||
let l:revision = "HEAD"
|
let l:revision = ""
|
||||||
let l:name = expand("%")
|
let l:name = expand("%")
|
||||||
end
|
end
|
||||||
if a:first.a:last == ""
|
if a:first.a:last == ""
|
||||||
let l:input = system('git blame '.l:revision.' --line-porcelain -- '.l:name)
|
let l:command = 'git blame '.l:revision.' --line-porcelain -- '.l:name
|
||||||
else
|
else
|
||||||
let l:input = system('git blame '.l:revision.' --line-porcelain -L '.a:first.','.a:last.' -- '.l:name)
|
let l:command = 'git blame '.l:revision.' --line-porcelain -L '.a:first.','.a:last.' -- '.l:name
|
||||||
end
|
end
|
||||||
|
let l:input = system(l:command)
|
||||||
if v:shell_error
|
if v:shell_error
|
||||||
throw v:shell_error
|
throw v:shell_error
|
||||||
else
|
else
|
||||||
let l:array = map(split(l:input, '\ze\x\{40} \d\+ \d\+'), s:split_blame_entry_ref)
|
let l:split = split(l:input, '\n\t[^\n]*\n')
|
||||||
|
let l:array = map(l:split, s:split_blame_entry_ref)
|
||||||
return l:array
|
return l:array
|
||||||
end
|
end
|
||||||
endfun
|
endfun
|
||||||
|
|
Loading…
Reference in a new issue