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
|
||||
|
||||
function! s:repo_configured_tree() dict abort
|
||||
if filereadable(self.dir('config'))
|
||||
let config = readfile(self.dir('config'),10)
|
||||
call filter(config,'v:val =~# "^\\s*worktree *="')
|
||||
if len(config) == 1
|
||||
return matchstr(config[0], '= *\zs.*')
|
||||
if !has_key(self,'_tree')
|
||||
let self._tree = ''
|
||||
if filereadable(self.dir('config'))
|
||||
let config = readfile(self.dir('config'),10)
|
||||
call filter(config,'v:val =~# "^\\s*worktree *="')
|
||||
if len(config) == 1
|
||||
let self._tree = matchstr(config[0], '= *\zs.*')
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
return ''
|
||||
return self._tree
|
||||
endfunction
|
||||
|
||||
function! s:repo_tree(...) dict abort
|
||||
|
Loading…
Reference in New Issue
Block a user