mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
Extract setting of path.
This commit is contained in:
@@ -27,13 +27,9 @@ function! gitgutter#process_buffer(bufnr, force) abort
|
||||
|
||||
call s:setup_maps(a:bufnr)
|
||||
|
||||
let p = gitgutter#utility#repo_path(a:bufnr, 0)
|
||||
if type(p) != s:t_string || empty(p)
|
||||
let Continuation = function('gitgutter#process_buffer', [a:bufnr, a:force])
|
||||
let ret = gitgutter#utility#set_repo_path(a:bufnr, Continuation)
|
||||
if ret ==# 'async'
|
||||
return
|
||||
endif
|
||||
let how = s:setup_path(a:bufnr, function('gitgutter#process_buffer', [a:bufnr, a:force]))
|
||||
if [how] == ['async'] " avoid string-to-number conversion if how is a number
|
||||
return
|
||||
endif
|
||||
|
||||
if a:force || s:has_fresh_changes(a:bufnr)
|
||||
@@ -149,6 +145,13 @@ function! s:setup_maps(bufnr)
|
||||
call gitgutter#utility#setbufvar(a:bufnr, 'mapped', 1)
|
||||
endfunction
|
||||
|
||||
function! s:setup_path(bufnr, continuation)
|
||||
let p = gitgutter#utility#repo_path(a:bufnr, 0)
|
||||
if type(p) != s:t_string || empty(p)
|
||||
return gitgutter#utility#set_repo_path(a:bufnr, a:continuation)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:has_fresh_changes(bufnr) abort
|
||||
return getbufvar(a:bufnr, 'changedtick') != gitgutter#utility#getbufvar(a:bufnr, 'tick')
|
||||
endfunction
|
||||
|
||||
Reference in New Issue
Block a user