about summary refs log tree commit diff
path: root/Functions/VCS_Info/VCS_INFO_bydir_detect
diff options
context:
space:
mode:
Diffstat (limited to 'Functions/VCS_Info/VCS_INFO_bydir_detect')
-rw-r--r--Functions/VCS_Info/VCS_INFO_bydir_detect15
1 files changed, 7 insertions, 8 deletions
diff --git a/Functions/VCS_Info/VCS_INFO_bydir_detect b/Functions/VCS_Info/VCS_INFO_bydir_detect
index 70b0fb6fa..b20c05c9c 100644
--- a/Functions/VCS_Info/VCS_INFO_bydir_detect
+++ b/Functions/VCS_Info/VCS_INFO_bydir_detect
@@ -4,11 +4,11 @@
 
 setopt localoptions NO_shwordsplit
 local dirname=$1
-local basedir="." realbasedir file
+local basedir="." file
 
-realbasedir="$(VCS_INFO_realpath ${basedir})"
-while [[ ${realbasedir} != '/' ]]; do
-    [[ -r ${realbasedir} ]] || return 1
+basedir=${basedir:P}
+while [[ ${basedir} != '/' ]]; do
+    [[ -r ${basedir} ]] || return 1
     if [[ -n ${vcs_comm[detect_need_file]} ]] ; then
         [[ -d ${basedir}/${dirname} ]] && {
             for file in ${(s: :)${vcs_comm[detect_need_file]}}; do
@@ -19,10 +19,9 @@ while [[ ${realbasedir} != '/' ]]; do
         [[ -d ${basedir}/${dirname} ]] && break
     fi
 
-    basedir=${basedir}/..
-    realbasedir="$(VCS_INFO_realpath ${basedir})"
+    basedir=${basedir:h}
 done
 
-[[ ${realbasedir} == "/" ]] && return 1
-vcs_comm[basedir]=${realbasedir}
+[[ ${basedir} == "/" ]] && return 1
+vcs_comm[basedir]=${basedir}
 return 0