Only run s:set_signs() if diff was found
This commit is contained in:
parent
6c2b6c4f08
commit
f6a0a50e06
@ -69,7 +69,10 @@ function! sy#start() abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Function: #set_signs {{{1
|
||||
function! sy#set_signs(diff, do_register) abort
|
||||
call sy#verbose('s:set_signs()', b:sy.vcs)
|
||||
|
||||
if b:sy.vcs == 'unknown'
|
||||
call sy#verbose('No VCS found. Disabling.')
|
||||
call sy#disable()
|
||||
@ -84,7 +87,7 @@ function! sy#set_signs(diff, do_register) abort
|
||||
let g:sy_cache[dir] = b:sy.vcs
|
||||
endif
|
||||
if empty(a:diff)
|
||||
call sy#verbose('No changes found.')
|
||||
call sy#verbose('No changes found.', b:sy.vcs)
|
||||
return
|
||||
endif
|
||||
endif
|
||||
|
@ -38,10 +38,8 @@ endfunction
|
||||
|
||||
" Function: s:callback_exit {{{1
|
||||
function! s:callback_exit(job_id, exitval) dict abort
|
||||
call sy#verbose('callback_exit()', self.vcs)
|
||||
if !a:exitval
|
||||
call sy#repo#get_diff_{self.vcs}(a:exitval, self.stdoutbuf, self.do_register)
|
||||
endif
|
||||
call sy#verbose('s:callback_exit()', self.vcs)
|
||||
call sy#repo#get_diff_{self.vcs}(a:exitval, self.stdoutbuf, self.do_register)
|
||||
silent! unlet b:job_id_{self.vcs}
|
||||
endfunction
|
||||
|
||||
@ -96,13 +94,13 @@ endfunction
|
||||
" Function: s:get_diff_end {{{1
|
||||
function! s:get_diff_end(found_diff, vcs, diff, do_register) abort
|
||||
call sy#verbose('s:get_diff_end()', a:vcs)
|
||||
if a:found_diff
|
||||
let b:sy.vcs = a:vcs
|
||||
endif
|
||||
if !a:do_register
|
||||
let b:sy.id_top = g:id_top
|
||||
endif
|
||||
call sy#set_signs(a:diff, a:do_register)
|
||||
if a:found_diff
|
||||
let b:sy.vcs = a:vcs
|
||||
call sy#set_signs(a:diff, a:do_register)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Function: #get_diff_git {{{1
|
||||
@ -115,42 +113,42 @@ endfunction
|
||||
" Function: #get_diff_hg {{{1
|
||||
function! sy#repo#get_diff_hg(exitval, diff, do_register) abort
|
||||
call sy#verbose('get_diff_hg()', 'hg')
|
||||
let [found_diff, diff] = v:shell_error ? [0, ''] : [1, a:diff]
|
||||
let [found_diff, diff] = a:exitval ? [0, ''] : [1, a:diff]
|
||||
call s:get_diff_end(found_diff, 'hg', diff, a:do_register)
|
||||
endfunction
|
||||
|
||||
" Function: #get_diff_svn {{{1
|
||||
function! sy#repo#get_diff_svn(exitval, diff, do_register) abort
|
||||
call sy#verbose('get_diff_svn()', 'svn')
|
||||
let [found_diff, diff] = v:shell_error ? [0, ''] : [1, a:diff]
|
||||
let [found_diff, diff] = a:exitval ? [0, ''] : [1, a:diff]
|
||||
call s:get_diff_end(found_diff, 'svn', diff, a:do_register)
|
||||
endfunction
|
||||
|
||||
" Function: #get_diff_bzr {{{1
|
||||
function! sy#repo#get_diff_bzr(exitval, diff, do_register) abort
|
||||
call sy#verbose('get_diff_bzr()', 'bzr')
|
||||
let [found_diff, diff] = (v:shell_error =~ '[012]') ? [1, a:diff] : [0, '']
|
||||
let [found_diff, diff] = (a:exitval =~ '[012]') ? [1, a:diff] : [0, '']
|
||||
call s:get_diff_end(found_diff, 'bzr', diff, a:do_register)
|
||||
endfunction
|
||||
|
||||
" Function: #get_diff_darcs {{{1
|
||||
function! sy#repo#get_diff_darcs(exitval, diff, do_register) abort
|
||||
call sy#verbose('get_diff_darcs()', 'darcs')
|
||||
let [found_diff, diff] = v:shell_error ? [0, ''] : [1, a:diff]
|
||||
let [found_diff, diff] = a:exitval ? [0, ''] : [1, a:diff]
|
||||
call s:get_diff_end(found_diff, 'darcs', diff, a:do_register)
|
||||
endfunction
|
||||
|
||||
" Function: #get_diff_fossil {{{1
|
||||
function! sy#repo#get_diff_fossil(exitval, diff, do_register) abort
|
||||
call sy#verbose('get_diff_fossil()', 'fossil')
|
||||
let [found_diff, diff] = v:shell_error ? [0, ''] : [1, a:diff]
|
||||
let [found_diff, diff] = a:exitval ? [0, ''] : [1, a:diff]
|
||||
call s:get_diff_end(found_diff, 'fossil', diff, a:do_register)
|
||||
endfunction
|
||||
|
||||
" Function: #get_diff_cvs {{{1
|
||||
function! sy#repo#get_diff_cvs(exitval, diff, do_register) abort
|
||||
call sy#verbose('get_diff_cvs()', 'cvs')
|
||||
let [found_diff, diff] = ((v:shell_error == 1) && (a:diff =~ '+++'))
|
||||
let [found_diff, diff] = ((a:exitval == 1) && (a:diff =~ '+++'))
|
||||
\ ? [1, diff]
|
||||
\ : [0, '']
|
||||
call s:get_diff_end(found_diff, 'cvs', diff, a:do_register)
|
||||
@ -159,30 +157,28 @@ endfunction
|
||||
" Function: #get_diff_rcs {{{1
|
||||
function! sy#repo#get_diff_rcs() abort
|
||||
call sy#verbose('get_diff_rcs()', 'rcs')
|
||||
let [found_diff, diff] = v:shell_error ? [0, ''] : [1, a:diff]
|
||||
let [found_diff, diff] = a:exitval ? [0, ''] : [1, a:diff]
|
||||
call s:get_diff_end(found_diff, 'rcs', diff, a:do_register)
|
||||
endfunction
|
||||
|
||||
" Function: #get_diff_accurev {{{1
|
||||
function! sy#repo#get_diff_accurev() abort
|
||||
call sy#verbose('get_diff_accurev()', 'accurev')
|
||||
let [found_diff, diff] = (v:shell_error >= 2) ? [0, ''] : [1, a:diff]
|
||||
let [found_diff, diff] = (a:exitval >= 2) ? [0, ''] : [1, a:diff]
|
||||
call s:get_diff_end(found_diff, 'accurev', diff, a:do_register)
|
||||
endfunction
|
||||
|
||||
" Function: #get_diff_perforce {{{1
|
||||
function! sy#repo#get_diff_perforce() abort
|
||||
call sy#verbose('get_diff_perforce()', 'perforce')
|
||||
let [found_diff, diff] = v:shell_error ? [0, ''] : [1, a:diff]
|
||||
let [found_diff, diff] = a:exitval ? [0, ''] : [1, a:diff]
|
||||
call s:get_diff_end(found_diff, 'perforce', diff, a:do_register)
|
||||
endfunction
|
||||
|
||||
" Function: #get_diff_tfs {{{1
|
||||
function! sy#repo#get_diff_tfs() abort
|
||||
call sy#verbose('get_diff_tfs()', 'tfs')
|
||||
let [found_diff, diff] = v:shell_error
|
||||
\ ? [0, '']
|
||||
\ : [1, s:strip_context(a:diff)]
|
||||
let [found_diff, diff] = a:exitval ? [0, ''] : [1, s:strip_context(a:diff)]
|
||||
call s:get_diff_end(found_diff, 'tfs', diff, a:do_register)
|
||||
endfunction
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user