mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 19:43:47 -05:00
Move comment and adjust whitespace for clarity.
This commit is contained in:
@@ -123,12 +123,9 @@ function! gitgutter#diff#run_diff(realtime, preserve_full_diff)
|
|||||||
endif
|
endif
|
||||||
end
|
end
|
||||||
|
|
||||||
if g:gitgutter_async && has('nvim') && !a:preserve_full_diff
|
let cmd = gitgutter#utility#command_in_directory_of_file(cmd)
|
||||||
let cmd = gitgutter#utility#command_in_directory_of_file(cmd)
|
|
||||||
" Note that when `cmd` doesn't produce any output, i.e. the diff is empty,
|
|
||||||
" the `stdout` event is not fired on the job handler. Therefore we keep
|
|
||||||
" track of the jobs ourselves so we can spot empty diffs.
|
|
||||||
|
|
||||||
|
if g:gitgutter_async && has('nvim') && !a:preserve_full_diff
|
||||||
let job_id = jobstart([&shell, '-c', cmd], {
|
let job_id = jobstart([&shell, '-c', cmd], {
|
||||||
\ 'on_stdout': function('gitgutter#handle_diff_job'),
|
\ 'on_stdout': function('gitgutter#handle_diff_job'),
|
||||||
\ 'on_stderr': function('gitgutter#handle_diff_job'),
|
\ 'on_stderr': function('gitgutter#handle_diff_job'),
|
||||||
@@ -139,14 +136,20 @@ function! gitgutter#diff#run_diff(realtime, preserve_full_diff)
|
|||||||
throw 'diff failed'
|
throw 'diff failed'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Note that when `cmd` doesn't produce any output, i.e. the diff is empty,
|
||||||
|
" the `stdout` event is not fired on the job handler. Therefore we keep
|
||||||
|
" track of the jobs ourselves so we can spot empty diffs.
|
||||||
call gitgutter#utility#pending_job(job_id)
|
call gitgutter#utility#pending_job(job_id)
|
||||||
|
|
||||||
return 'async'
|
return 'async'
|
||||||
else
|
else
|
||||||
let diff = gitgutter#utility#system(gitgutter#utility#command_in_directory_of_file(cmd))
|
let diff = gitgutter#utility#system(cmd)
|
||||||
|
|
||||||
if gitgutter#utility#shell_error()
|
if gitgutter#utility#shell_error()
|
||||||
" A shell error indicates the file is not tracked by git (unless something bizarre is going on).
|
" A shell error indicates the file is not tracked by git (unless something bizarre is going on).
|
||||||
throw 'diff failed'
|
throw 'diff failed'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return diff
|
return diff
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
Reference in New Issue
Block a user