Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH]: vcs_info git: Describe detached heads symbolically.
- X-seq: zsh-workers 32597
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH]: vcs_info git: Describe detached heads symbolically.
- Date: Tue, 6 May 2014 12:05:21 +0000
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:to:subject:message-id :mime-version:content-type; s=mesmtp; bh=B6CEu36tUu3DLPoi4Z3P5Tt LzwQ=; b=l3KMfSeBqLpRsEMtxdibIfeZC8HpYHR/Q45ahWir8+oYqFadQ/yq1Sz R223mTkV7L/cBmKBMEe4pUR0EDB40QFlvDUKZxLOkinyKYJ+sI6vNSjcRRG+1/ki W50pHozQVnTbqyHV4W5gUJxt+S8dGJDhGU1MaWbt6UvK3NmdqwiI=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=date:from:to:subject:message-id :mime-version:content-type; s=smtpout; bh=B6CEu36tUu3DLPoi4Z3P5T tLzwQ=; b=qEtfEka6gd3r1QZ7EnzbczDuU0F5UFehBTeRkCWPrwYsdaZIXRUN6O SSDRI/RRUrYh7JEBOih/kEQnMNfBx8t77pJHNcnkjqVW22XV96xODmwRbKgNczrA HPAVC1CjakOhlZ2IICCPX/+auKp2Xup9WzST0IET5S0lJ3zg02Zm4=
- 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
A one-liner patch that makes the vcs_info prompt display symbolic names
in one more case.
Without this patch:
[[[
master ccc840470aa9
% git checkout $(git rev-parse HEAD)
ccc8404... ccc840470aa9
%
]]]
With this patch:
[[[
master ccc840470aa9
% git checkout $(git rev-parse HEAD)
heads/master ccc840470aa9
%
]]]
From 0aac472424ca671d2c2715eaac880684ad59c9d6 Mon Sep 17 00:00:00 2001
From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
Date: Tue, 8 Apr 2014 21:07:28 +0000
Subject: [PATCH 3/3] vcs_info git: Describe detached heads symbolically.
This makes %b expand to a refname rather than a sha1 when HEAD is detached but
happens to match some ref (branch, tag, etc). The resulting output will
typically contain a slash (e.g., "tags/v1.0.2", "heads/mybranch"), which helps
distinguish it from the output in the "HEAD is a symbolic ref" case.
---
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 6512851..a48dc39 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -97,7 +97,7 @@ VCS_INFO_git_getbranch () {
gitbranch="$(${(z)gitsymref} 2> /dev/null)"
if [[ $? -ne 0 ]] ; then
- gitbranch="refs/tags/$(${vcs_comm[cmd]} describe --exact-match HEAD 2>/dev/null)"
+ gitbranch="refs/tags/$(${vcs_comm[cmd]} describe --all --exact-match HEAD 2>/dev/null)"
if [[ $? -ne 0 ]] ; then
gitbranch="${${"$(< $gitdir/HEAD)"}[1,7]}..."
--
1.7.10.4
Messages sorted by:
Reverse Date,
Date,
Thread,
Author