From 46a2f58e1de173bc484f4583d29765ccd6fa904a Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Thu, 26 Aug 2021 11:10:39 -0400 Subject: [PATCH] Provide utility function to expire cached config This is primarily for troubleshooting, but might also be handy for users of includeIf. --- autoload/fugitive.vim | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 8e4917a..eba4478 100644 --- 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 ''