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

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



On 11/21/13, 8:16 AM, Bart Schaefer wrote:
On Nov 20,  5:45pm, Hong Xu wrote:
} Subject: [BUG] vcs_info '%r' doesn't work properly when entered a subdirec
}
} 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

This is coming from VCS_INFO_get_data_git, in this expression:

gitbase=${PWD%/${$( ${vcs_comm[cmd]} rev-parse --show-prefix )%/##}}

This is computing the value for %R, which is then converted with the :t
modifier into a path tail for %r.

I believe the issue is that because you've symlink'd your way into a
subdirectory, $PWD no longer includes the full path that is being
returned by --show-prefix, so the substitution does nothing.

What I don't know is the desired outcome.  Try replacing $PWD in that
function with $(pwd -P) and see if that gives you what you want?  Is
that what everyone would expect here?


Hi Bart,

Yes, $(pwd -P) indeed gives the correct %r. However, %S is incorrect then...

Hong



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