Fix `VCS_INFO_realpath()' for zsh 4.3.10 and below
authorFrank Terbeck <ft@grml.org>
Fri, 3 Dec 2010 10:26:36 +0000 (11:26 +0100)
committerFrank Terbeck <ft@grml.org>
Fri, 3 Dec 2010 10:26:36 +0000 (11:26 +0100)
If the chpwd hook is activated by using the `chpwd_functions[]' array,
could break `VCS_INFO_realpath()', which could lead to endless loops in
`vcs_info' if the one of the hook functions produced output.

This fixes it.

I'm refraining from patching the grmlzshrc-included
`VCS_INFO_realpath()' function, because the use of "cd -q" requires a
pretty recent version of the shell.

etc/zsh/zshrc

index c1cc68d..a8b887a 100644 (file)
@@ -1143,6 +1143,15 @@ fi
 
 if zrcautoload vcs_info; then
     GRML_VCS_INFO=0
+    # `vcs_info' in zsh versions 4.3.10 and below have a broken `_realpath'
+    # function, which can cause a lot of trouble with our directory-based
+    # profiles. So:
+    if [[ ${ZSH_VERSION} == 4.3.<-10> ]] ; then
+        function VCS_INFO_realpath () {
+            setopt localoptions NO_shwordsplit chaselinks
+            ( builtin cd -q $1 2> /dev/null && pwd; )
+        }
+    fi
 else
 # I'm not reindenting the whole code below.
 GRML_VCS_INFO=1