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



At 18:13 -0500 21 Nov 2013, I wrote:
At 17:45 -0800 20 Nov 2013, Hong Xu <hong@xxxxxxxxxx> wrote:
The vcs_info '%r' generally works perfect, but when I symlinked a subdirectory of the root dir of the git repository to somewhere else, and cd from the symlink, '%r' doesn't show the correct value, while the git repository can be recognized by zsh.

This sounds like it may be the same issue that was addressed by the patch in workers:31985 (http://www.zsh.org/mla/workers/2013/msg01038.html), sent by Clemens Hammacher. It doesn't look like that patch has been applied to the git repository yet, but it looks like a good solution to me.

Since the patch is short, I'll include the content here:

Looking at the copy that I got back from the mailing list, I see that I mistakenly let my editor do wrapping on that patch which broke it. Here's another try at it:

diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index c44be39..e6791cb 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_adjust
VCS_INFO_git_getaction ${gitdir}
-gitbase=${PWD%/${$( ${vcs_comm[cmd]} rev-parse --show-prefix )%/##}}
+gitbase=$( ${vcs_comm[cmd]} rev-parse --show-toplevel )
rrn=${gitbase:t}

local patchdir=${gitdir}/patches/${gitbranch}



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