commit 46a2f58e1de173bc484f4583d29765ccd6fa904a (tree)
parent 126363be5aabebbc349155680829b7661ae1c3df
Author: Tim Pope <code@tpope.net>
Date: Thu, 26 Aug 2021 11:10:39 -0400
Provide utility function to expire cached config
This is primarily for troubleshooting, but might also be handy for
users of includeIf.
Diffstat:
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim
@@ -954,6 +954,17 @@ endfunction
let s:config_prototype = {}
let s:config = {}
+function! fugitive#ExpireConfig(...) abort
+ if !a:0 || a:1 is# 0
+ let s:config = {}
+ else
+ let key = a:1 is# '' ? '_' : s:GitDir(a:0 ? a:1 : -1)
+ if len(key) && has_key(s:config, key)
+ call remove(s:config, key)
+ endif
+ endif
+endfunction
+
function! fugitive#Config(...) abort
let name = ''
let default = get(a:, 3, '')
@@ -3897,7 +3908,7 @@ if !exists('s:last_times')
endif
function! s:ExpireStatus(bufnr) abort
- if a:bufnr is# -2
+ if a:bufnr is# -2 || a:bufnr is# 0
let s:head_cache = {}
let s:last_time = reltime()
return ''