zsh-workers
 help / color / mirror / code / Atom feed
From: Kouhei Yanagita <yanagi@shakenbu.org>
To: zsh-workers@zsh.org
Subject: PATCH: replace VCS_INFO_readpath with a modifier
Date: Sat, 14 Feb 2015 17:33:22 +0900	[thread overview]
Message-ID: <CAKDHU4S8naoK9fRpPeYDY7WsnXKf0pgMKJJZHKgZcpDOZgAZxQ@mail.gmail.com> (raw)

[-- 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
 

                 reply	other threads:[~2015-02-14  8:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKDHU4S8naoK9fRpPeYDY7WsnXKf0pgMKJJZHKgZcpDOZgAZxQ@mail.gmail.com \
    --to=yanagi@shakenbu.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).