diff options
author | dana <dana@dana.is> | 2018-06-16 12:03:23 -0500 |
---|---|---|
committer | dana <dana@dana.is> | 2018-06-16 12:03:23 -0500 |
commit | faa07d064bb2bd9cd9892a255a4b63811242b9fb (patch) | |
tree | bfafce52bdc73d54f6319a51b5263ea65dbfb232 /Functions/VCS_Info/VCS_INFO_bydir_detect | |
parent | 0daeed20e1828b9026b8800555d3f5dad1088544 (diff) | |
download | zsh-faa07d064bb2bd9cd9892a255a4b63811242b9fb.tar.gz zsh-faa07d064bb2bd9cd9892a255a4b63811242b9fb.tar.xz zsh-faa07d064bb2bd9cd9892a255a4b63811242b9fb.zip |
43030: Replace VCS_INFO_realpath() by :P
Diffstat (limited to 'Functions/VCS_Info/VCS_INFO_bydir_detect')
-rw-r--r-- | Functions/VCS_Info/VCS_INFO_bydir_detect | 15 |
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 |