Improve detection of nested repos managed by different VCS
Assume a hg repo below a git repo. `git diff` on a file managed by hg, will return a successful exit value, but no output. So, if we got a successful exit value from multiple VCS tools, and none of them gave any output, keep them all as potential candidates. The next time Sy is run, only these candidates will be tested again. If one of them returns a proper diff, set b:sy.updated_by to that VCS and prune all other candidates. References #235
This commit is contained in:
parent
3d3edac39d
commit
8351e5212f
@ -66,7 +66,6 @@ function! sy#start() abort
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let b:sy.updated_by = ''
|
|
||||||
for vcs in b:sy.vcs
|
for vcs in b:sy.vcs
|
||||||
let job_id = get(b:, 'sy_job_id_'. vcs)
|
let job_id = get(b:, 'sy_job_id_'. vcs)
|
||||||
if type(job_id) != type(0) || job_id > 0
|
if type(job_id) != type(0) || job_id > 0
|
||||||
|
@ -51,7 +51,7 @@ function! s:job_exit(bufnr, vcs, exitval, diff) abort
|
|||||||
if empty(sy)
|
if empty(sy)
|
||||||
call sy#verbose(printf('No b:sy found for %s', bufname(a:bufnr)), a:vcs)
|
call sy#verbose(printf('No b:sy found for %s', bufname(a:bufnr)), a:vcs)
|
||||||
return
|
return
|
||||||
elseif !empty(sy.updated_by)
|
elseif !empty(sy.updated_by) && sy.updated_by != a:vcs
|
||||||
call sy#verbose(printf('Signs already got updated by %s.', sy.updated_by), a:vcs)
|
call sy#verbose(printf('Signs already got updated by %s.', sy.updated_by), a:vcs)
|
||||||
return
|
return
|
||||||
elseif empty(sy.vcs) && sy.active
|
elseif empty(sy.vcs) && sy.active
|
||||||
|
@ -194,6 +194,11 @@ function! sy#sign#process_diff(sy, vcs, diff) abort
|
|||||||
call feedkeys("\<c-l>", 'n')
|
call feedkeys("\<c-l>", 'n')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if empty(a:sy.updated_by) && empty(a:sy.hunks)
|
||||||
|
call sy#verbose('Successful exit value, but no diff. Keep VCS for time being.', a:vcs)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
call sy#verbose('Signs updated.', a:vcs)
|
call sy#verbose('Signs updated.', a:vcs)
|
||||||
let a:sy.updated_by = a:vcs
|
let a:sy.updated_by = a:vcs
|
||||||
if len(a:sy.vcs) > 1
|
if len(a:sy.vcs) > 1
|
||||||
|
Loading…
Reference in New Issue
Block a user