Add more calls to sy#verbose()

This commit is contained in:
Marco Hinz 2017-01-17 17:03:34 +01:00
parent e72ccb952d
commit a67b613acf
No known key found for this signature in database
GPG Key ID: 1C980A1B657B4A4F
2 changed files with 17 additions and 18 deletions

View File

@ -18,12 +18,14 @@ endfunction
" Function: #start {{{1
function! sy#start() abort
if g:signify_locked
call sy#verbose('Locked.')
return
endif
let sy_path = resolve(expand('%:p'))
if s:skip(sy_path)
call sy#verbose('Skip file.')
if exists('b:sy')
call sy#sign#remove_all_signs(bufnr(''))
unlet! b:sy b:sy_info
@ -47,7 +49,7 @@ function! sy#start() abort
\ }
if !exists('b:sy') || b:sy.path != sy_path
call sy#verbose('Register new file: '. sy_path)
call sy#verbose('Register new file.')
let b:sy = {
\ 'path' : sy_path,
\ 'buffer': bufnr(''),
@ -57,42 +59,39 @@ function! sy#start() abort
\ 'id_top': g:id_top,
\ 'stats' : [-1, -1, -1] }
if get(g:, 'signify_disable_by_default')
call sy#verbose('Disabled by default.')
return
endif
let b:sy.active = 1
call sy#repo#detect(1)
elseif !b:sy.active
call sy#verbose('Inactive buffer: '. sy_path)
call sy#verbose('Inactive buffer.')
return
elseif b:sy.type == 'unknown'
call sy#verbose('Retry detecting VCS: '. sy_path)
call sy#verbose('Retry detecting VCS.')
call sy#repo#detect(0)
else
call sy#verbose('Update signs: '. sy_path)
call sy#verbose('Updating signs.')
call sy#repo#get_diff_{b:sy.type}(0)
endif
endfunction
function! sy#update_signs(diff, do_register) abort
" if b:sy.type == 'unknown'
" echomsg 'DEBUG: type unknown'
" " no VCS found
" call sy#disable()
" return
" endif
function! sy#set_signs(diff, do_register) abort
if b:sy.type == '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')
let dir = fnamemodify(b:sy.path, ':h')
if !has_key(g:sy_cache, dir)
let g:sy_cache[dir] = b:sy.type
endif
if empty(a:diff)
" no changes found
call sy#verbose('No changes found.')
return
endif
endif
@ -104,7 +103,6 @@ function! sy#update_signs(diff, do_register) abort
endif
call sy#sign#process_diff(a:diff)
let b:sy.id_top = (g:id_top - 1)
if exists('#User#Signify')

View File

@ -40,19 +40,20 @@ endfunction
" Function: s:callback_exit {{{1
function! s:callback_exit(_job_id, exitcode, _event) dict abort
call sy#verbose('Running callback_exit(). Exit code: '. a:exitcode)
let [found_diff, diff] = a:exitcode ? [0, ''] : [1, join(self.stdoutbuf, "\n")]
" echomsg 'DEBUG: '. diff
if found_diff
let b:sy.type = 'git'
endif
if !self.do_register
let b:sy.id_top = g:id_top
endif
call sy#update_signs(diff, self.do_register)
call sy#set_signs(diff, self.do_register)
endfunction
" Function: #get_diff_git {{{1
function! sy#repo#get_diff_git(do_register) abort
call sy#verbose('Running get_diff_git().')
let cmd = s:expand_cmd(g:signify_vcs_cmds.git, b:sy_info.file)
let cmd = (has('win32') && &shell =~ 'cmd') ? cmd : ['sh', '-c', cmd]
if exists('s:job_id_git')