From 8edf8a06581667ca33477a864d7f93b2d6e9eccf Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 22 May 2009 15:48:32 +0000 Subject: 26970: Greg Klanderman: _subversion: fix caching. --- Completion/Unix/Command/_subversion | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'Completion/Unix/Command/_subversion') diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion index 01b2bbb2a..d31f0243a 100644 --- a/Completion/Unix/Command/_subversion +++ b/Completion/Unix/Command/_subversion @@ -22,7 +22,7 @@ _svn () { ;; args) local cmd args usage - typeset -gHA _cache_svn_status + typeset -gHA _cache_svn_status _cache_svn_mtime cmd="${${(k)_svn_cmds[(R)*:$words[1]:*]}:-${(k)_svn_cmds[(i):$words[1]:]}}" if (( $#cmd )); then @@ -193,11 +193,16 @@ _svn_status() { local dir=$REPLY:h local pat="${1:-([ADMR~]|?M)}" - if (( ! $+_cache_svn_status[$dir] )); then - _cache_svn_status[$dir]="$(_call_program files svn status -N $dir)" + zmodload -F zsh/stat b:zstat 2>/dev/null + local key="$(zstat +device $dir):$(zstat +inode $dir)" + local mtime="$(zstat +mtime $dir/.svn/entries)" + + if (( ! $+_cache_svn_status[$key] || _cache_svn_mtime[$key] != mtime )); then + _cache_svn_status[$key]="$(_call_program files svn status -N $dir)" + _cache_svn_mtime[$key]="$mtime" fi - (( ${(M)#${(f)_cache_svn_status[$dir]}:#(#s)${~pat}*$REPLY} )) + (( ${(M)#${(f)_cache_svn_status[$key]}:#(#s)${~pat}*$REPLY} )) } (( $+functions[_svn_urls] )) || -- cgit 1.4.1