From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11900 invoked by alias); 28 Nov 2013 22:03:29 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 32066 Received: (qmail 7658 invoked from network); 28 Nov 2013 22:03:14 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <131128140327.ZM25083@torch.brasslantern.com> Date: Thu, 28 Nov 2013 14:03:27 -0800 In-reply-to: <5296EF7E.1010407@topbug.net> Comments: In reply to Hong Xu "Re: vcs_info '%r' doesn't work properly when entered a subdirectory of a git repository through a symlink" (Nov 27, 11:23pm) References: <528D65C2.2080607@topbug.net> <20131121231319.GA23989@pug.qqx.org> <131121161050.ZM13254@torch.brasslantern.com> <528EB952.8010309@topbug.net> <5296EF7E.1010407@topbug.net> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Hong Xu Subject: Re: vcs_info '%r' doesn't work properly when entered a subdirectory of a git repository through a symlink Cc: zsh-workers@zsh.org MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Nov 27, 11:23pm, Hong Xu wrote: } } 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? Does the following also work for you? I'd like to preserve 31985 if possible. 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} 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