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

Re: [PATCH 4/9] vcs_info git: set rrn before using it



On Sun, 14 Sep 2014 11:33:03 +0200
Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx> wrote:

> Marc Finet wrote:
> > This would fix setting check-for-changes or
> > check-for-staged-changes per repository.
> 
> This is a good catch. There is another reference of $rrn earlier
> though at
> 
>   if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}"
> get-revision ; then
> 
> I think the chunk you moved should be moved before that.

Well spotted. Here is v2:

This would fix handling get-revision, check-for-changes or
check-for-staged-changes when set per repository.
---
 Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index
263a325..6231301 100644 ---
a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++
b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -115,6 +115,8 @@
VCS_INFO_git_getbranch () { 
 gitdir=${vcs_comm[gitdir]}
 VCS_INFO_git_getbranch ${gitdir}
+gitbase=$( ${vcs_comm[cmd]} rev-parse --show-toplevel )
+rrn=${gitbase:t}
 if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-revision ;
then gitsha1=$(${vcs_comm[cmd]} rev-parse --quiet --verify HEAD)
 else
@@ -154,8 +156,6 @@ fi
 
 VCS_INFO_adjust
 VCS_INFO_git_getaction ${gitdir}
-gitbase=$( ${vcs_comm[cmd]} rev-parse --show-toplevel )
-rrn=${gitbase:t}
 
 local patchdir=${gitdir}/patches/${gitbranch}
 if [[ -d $patchdir ]] && [[ -f $patchdir/applied ]] \
-- 
2.1.0




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