zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Hong Xu <hong@topbug.net>
Cc: zsh-workers@zsh.org
Subject: Re: vcs_info '%r' doesn't work properly when entered a subdirectory of a git repository through a symlink
Date: Thu, 28 Nov 2013 14:03:27 -0800	[thread overview]
Message-ID: <131128140327.ZM25083@torch.brasslantern.com> (raw)
In-Reply-To: <5296EF7E.1010407@topbug.net>

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


  reply	other threads:[~2013-11-28 22:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-21  1:45 [BUG] " Hong Xu
2013-11-21 16:16 ` Bart Schaefer
2013-11-21 19:12   ` Hong Xu
2013-11-21 23:13 ` Aaron Schrab
2013-11-21 23:26   ` Aaron Schrab
2013-11-22  0:10   ` Bart Schaefer
2013-11-22  1:54     ` Hong Xu
2013-11-28  7:23       ` Hong Xu
2013-11-28 22:03         ` Bart Schaefer [this message]
2013-11-29  0:43           ` Hong Xu

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=131128140327.ZM25083@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=hong@topbug.net \
    --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).