Don't retry VCS detection for performance purposes
For each new buffer sy#repo#detect() gets run. That function invokes callbacks for all VCS from g:signify_vcs_list. If no callback finds a valid repo, sy#set_signs() is never called and the VCS type of the newly registered buffer keeps its initial value: "unknown". The next time Sy gets run in that buffer, Sy will disable itself, so that all subsequent times it gets run it will never even attempt to get a diff. If a buffer was added to a repo that was initialized after Sy registered that buffer, it will remain inactive. In those cases, :SignifyEnable will purge the cache for the current buffer and start all over.
This commit is contained in:
parent
f6a0a50e06
commit
3f9c4e4ea0
@ -61,8 +61,8 @@ function! sy#start() abort
|
||||
call sy#verbose('Inactive buffer.')
|
||||
return
|
||||
elseif b:sy.vcs == 'unknown'
|
||||
call sy#verbose('Retry detecting VCS.')
|
||||
call sy#repo#detect(0)
|
||||
call sy#verbose('No VCS found. Disabling.')
|
||||
call sy#disable()
|
||||
else
|
||||
call sy#verbose('Updating signs.')
|
||||
call sy#repo#get_diff_start(b:sy.vcs, 0)
|
||||
@ -73,14 +73,7 @@ endfunction
|
||||
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()
|
||||
return
|
||||
endif
|
||||
|
||||
if a:do_register
|
||||
" register file as active with found VCS
|
||||
let b:sy.stats = [0, 0, 0]
|
||||
let dir = fnamemodify(b:sy.path, ':h')
|
||||
if !has_key(g:sy_cache, dir)
|
||||
@ -118,15 +111,8 @@ endfunction
|
||||
|
||||
" Function: #enable {{{1
|
||||
function! sy#enable() abort
|
||||
if !exists('b:sy')
|
||||
call sy#start()
|
||||
return
|
||||
endif
|
||||
|
||||
if !b:sy.active
|
||||
let b:sy.active = 1
|
||||
call sy#start()
|
||||
endif
|
||||
silent! unlet b:sy b:sy_info
|
||||
call sy#start()
|
||||
endfunction
|
||||
|
||||
" Function: #disable {{{1
|
||||
|
Loading…
Reference in New Issue
Block a user