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

View File

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