Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] Ask git for its toplevel directory directly
- X-seq: zsh-workers 31985
- From: Clemens Hammacher <hammacher@xxxxxxxxxxxxxxxxxx>
- To: Zsh Workers List <zsh-workers@xxxxxxx>
- Subject: [PATCH] Ask git for its toplevel directory directly
- Date: Thu, 14 Nov 2013 18:22:23 +0100
- Cc: Clemens Hammacher <hammacher@xxxxxxxxxxxxxxxxxx>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
This avoids printing the wrong base directory if $PWD contains a
symlink. If /tmp is the base and $PWD is /tmp/b, where b is a symlink
(to "." or any other directory), git rev-parse --show-prefix will show
the link target instead of b. Thus the replacement in $PWD does not
work.
Fortunately, there also exists git rev-parse --show-toplevel, which
reliably returns the base directory.
---
Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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}
--
1.8.4.2
Messages sorted by:
Reverse Date,
Date,
Thread,
Author