Check buffer is active before init.

This commit is contained in:
Andy Stewart
2018-02-12 15:34:49 +00:00
parent 5bfe5b9209
commit 1452900ffd

View File

@@ -13,9 +13,11 @@ endfunction
" Finds the file's path relative to the repo root.
function! gitgutter#init_buffer(bufnr)
let p = gitgutter#utility#repo_path(a:bufnr, 0)
if type(p) != v:t_string || empty(p)
call gitgutter#utility#set_repo_path(a:bufnr)
if gitgutter#utility#is_active(a:bufnr)
let p = gitgutter#utility#repo_path(a:bufnr, 0)
if type(p) != v:t_string || empty(p)
call gitgutter#utility#set_repo_path(a:bufnr)
endif
endif
endfunction