zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: replace VCS_INFO_readpath with a modifier
@ 2015-02-14  8:33 Kouhei Yanagita
  0 siblings, 0 replies; only message in thread
From: Kouhei Yanagita @ 2015-02-14  8:33 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 195 bytes --]

Hi.

I think VCS_INFO_realpath can be replaced with a modifier `:A'.
This substitution improves performance especially on Cygwin.

I attach a patch.

-- 
Kouhei Yanagita <yanagi at shakenbu.org>

[-- Attachment #2: vcs_info.patch --]
[-- Type: application/octet-stream, Size: 3221 bytes --]

diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr b/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr
index cae1a3b..97a29c5 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr
@@ -81,7 +81,7 @@ else
             bzrbase=${bzr_info[branch_root]} ;;
     esac
 
-    bzrbase="$(VCS_INFO_realpath ${bzrbase})"
+    bzrbase="${bzrbase:A}"
 
     if [ -n "${bzr_info[checkout_of_branch]}" ] && \
        zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" "use-server"
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs b/Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs
index ed738b9..bbae478 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs
@@ -9,7 +9,7 @@ cvsbase="."
 while [[ -d "${cvsbase}/../CVS" ]]; do
     cvsbase="${cvsbase}/.."
 done
-cvsbase="$(VCS_INFO_realpath ${cvsbase})"
+cvsbase="${cvsbase:A}"
 cvsbranch=$(< ./CVS/Repository)
 rrn=${cvsbase:t}
 cvsbranch=${cvsbranch##${rrn}/}
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn
index e56afee..7e4946a 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn
@@ -46,7 +46,7 @@ else
   done
 fi
 
-svnbase="$(VCS_INFO_realpath ${svnbase})"
+svnbase="${svnbase:A}"
 
 rrn=${svnbase:t}
 zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" branchformat svnbranch || svnbranch="%b:%r"
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_tla b/Functions/VCS_Info/Backends/VCS_INFO_get_data_tla
index f015e0c..73873b7 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_tla
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_tla
@@ -5,7 +5,7 @@
 setopt localoptions extendedglob NO_shwordsplit
 local tlabase tlabranch
 
-tlabase="$(VCS_INFO_realpath ${vcs_comm[basedir]})"
+tlabase="${vcs_comm[basedir]:A}"
 rrn=${tlabase:t}
 # tree-id gives us something like 'foo@example.com/demo--1.0--patch-4', so:
 tlabranch=${${"$( ${vcs_comm[cmd]} tree-id )"}/*\//}
diff --git a/Functions/VCS_Info/VCS_INFO_bydir_detect b/Functions/VCS_Info/VCS_INFO_bydir_detect
index 70b0fb6..d790929 100644
--- a/Functions/VCS_Info/VCS_INFO_bydir_detect
+++ b/Functions/VCS_Info/VCS_INFO_bydir_detect
@@ -6,7 +6,7 @@ setopt localoptions NO_shwordsplit
 local dirname=$1
 local basedir="." realbasedir file
 
-realbasedir="$(VCS_INFO_realpath ${basedir})"
+realbasedir="${basedir:A}"
 while [[ ${realbasedir} != '/' ]]; do
     [[ -r ${realbasedir} ]] || return 1
     if [[ -n ${vcs_comm[detect_need_file]} ]] ; then
@@ -20,7 +20,7 @@ while [[ ${realbasedir} != '/' ]]; do
     fi
 
     basedir=${basedir}/..
-    realbasedir="$(VCS_INFO_realpath ${basedir})"
+    realbasedir="${basedir:A}"
 done
 
 [[ ${realbasedir} == "/" ]] && return 1
diff --git a/Functions/VCS_Info/vcs_info b/Functions/VCS_Info/vcs_info
index 4693869..a97b349 100644
--- a/Functions/VCS_Info/vcs_info
+++ b/Functions/VCS_Info/vcs_info
@@ -22,7 +22,6 @@ static_functions=(
     VCS_INFO_maxexports
     VCS_INFO_nvcsformats
     VCS_INFO_quilt
-    VCS_INFO_realpath
     VCS_INFO_reposub
     VCS_INFO_set
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-02-14  8:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-14  8:33 PATCH: replace VCS_INFO_readpath with a modifier Kouhei Yanagita

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).