Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: vcs_info '%r' doesn't work properly when entered a subdirectory of a git repository through a symlink

On 11/21/13, 5:54 PM, Hong Xu wrote:
On Thu Nov 21 16:10:50 2013, Bart Schaefer wrote:
On Nov 21,  6:13pm, Aaron Schrab wrote:
} This sounds like it may be the same issue that was addressed by the
} patch in workers:31985
} sent by Clemens Hammacher.

That's probably true, but looking at VCS_INFO_reposub I think applying
31985 is still going to break %S in the way Hong already mentioned.

I just tested this patch, yes it did break %S.

I tested the attached patch and it fixes the issue without breaking %S for me. Please give it a try, and if it is good, could you include this patch?


diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index c44be39..cd8f064 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -132,7 +132,7 @@ fi
 VCS_INFO_git_getaction ${gitdir}
-gitbase=${PWD%/${$( ${vcs_comm[cmd]} rev-parse --show-prefix )%/##}}
+gitbase=${$(pwd -P)%/${$( ${vcs_comm[cmd]} rev-parse --show-prefix )%/##}}
 local patchdir=${gitdir}/patches/${gitbranch}
diff --git a/Functions/VCS_Info/VCS_INFO_reposub b/Functions/VCS_Info/VCS_INFO_reposub
index 0fab863..1c16f0e 100644
--- a/Functions/VCS_Info/VCS_INFO_reposub
+++ b/Functions/VCS_Info/VCS_INFO_reposub
@@ -5,9 +5,9 @@
 setopt localoptions extendedglob NO_shwordsplit
 local base=${1%%/##}
-[[ ${PWD} == ${base}/* ]] || {
+[[ $(pwd -P) == ${base}/* ]] || {
     printf '.'
     return 1
-printf '%s' ${PWD#$base/}
+printf '%s' ${$(pwd -P)#$base/}
 return 0

Messages sorted by: Reverse Date, Date, Thread, Author