Fix HEAD cache expiry on FugitiveDidChange()

This commit is contained in:
Tim Pope
2022-05-10 23:28:09 -04:00
parent af8b352dbf
commit 87923d1b1b

View File

@@ -4194,11 +4194,11 @@ function! s:ExpireStatus(bufnr) abort
let s:last_time = reltime() let s:last_time = reltime()
return '' return ''
endif endif
let dir = s:Dir(a:bufnr) let head_file = fugitive#Find('.git/HEAD', a:bufnr)
if len(dir) if !empty(head_file)
let s:last_times[s:cpath(dir)] = reltime() let s:last_times[s:Tree(a:bufnr) . '/'] = reltime()
if has_key(s:head_cache, dir) if has_key(s:head_cache, head_file)
call remove(s:head_cache, dir) call remove(s:head_cache, head_file)
endif endif
endif endif
return '' return ''
@@ -4214,7 +4214,7 @@ function! s:ReloadWinStatus(...) abort
endif endif
let t = b:fugitive_reltime let t = b:fugitive_reltime
if reltimestr(reltime(s:last_time, t)) =~# '-\|\d\{10\}\.' || 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() exe s:ReloadStatusBuffer()
endif endif
endfunction endfunction