Cache configured worktree
Note that the repo object holding the cached value is short lived.
This commit is contained in:
parent
c5cd0c96f7
commit
dfb10448e2
@ -203,14 +203,17 @@ function! s:repo_dir(...) dict abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:repo_configured_tree() dict abort
|
function! s:repo_configured_tree() dict abort
|
||||||
if filereadable(self.dir('config'))
|
if !has_key(self,'_tree')
|
||||||
let config = readfile(self.dir('config'),10)
|
let self._tree = ''
|
||||||
call filter(config,'v:val =~# "^\\s*worktree *="')
|
if filereadable(self.dir('config'))
|
||||||
if len(config) == 1
|
let config = readfile(self.dir('config'),10)
|
||||||
return matchstr(config[0], '= *\zs.*')
|
call filter(config,'v:val =~# "^\\s*worktree *="')
|
||||||
|
if len(config) == 1
|
||||||
|
let self._tree = matchstr(config[0], '= *\zs.*')
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
return ''
|
return self._tree
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:repo_tree(...) dict abort
|
function! s:repo_tree(...) dict abort
|
||||||
|
Loading…
Reference in New Issue
Block a user