From 87923d1b1b0867f91a8e45bfe9777874223c761a Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Tue, 10 May 2022 23:28:09 -0400 Subject: [PATCH] Fix HEAD cache expiry on FugitiveDidChange() --- autoload/fugitive.vim | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index a0c0ae8..bd6ff94 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -4194,11 +4194,11 @@ function! s:ExpireStatus(bufnr) abort let s:last_time = reltime() return '' endif - let dir = s:Dir(a:bufnr) - if len(dir) - let s:last_times[s:cpath(dir)] = reltime() - if has_key(s:head_cache, dir) - call remove(s:head_cache, dir) + let head_file = fugitive#Find('.git/HEAD', a:bufnr) + if !empty(head_file) + let s:last_times[s:Tree(a:bufnr) . '/'] = reltime() + if has_key(s:head_cache, head_file) + call remove(s:head_cache, head_file) endif endif return '' @@ -4214,7 +4214,7 @@ function! s:ReloadWinStatus(...) abort endif let t = b:fugitive_reltime if reltimestr(reltime(s:last_time, t)) =~# '-\|\d\{10\}\.' || - \ reltimestr(reltime(get(s:last_times, s:cpath(s:Dir()), t), t)) =~# '-\|\d\{10\}\.' + \ reltimestr(reltime(get(s:last_times, s:Tree() . '/', t), t)) =~# '-\|\d\{10\}\.' exe s:ReloadStatusBuffer() endif endfunction