From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13118 invoked by alias); 6 May 2014 12:13:01 -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: 32597 Received: (qmail 14058 invoked from network); 6 May 2014 12:12:56 -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=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 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= X-Sasl-enc: PLKRzcuXhYBYNuWySFqJGXn1zi0npQnj1niTPW7le4Ad 1399377925 Date: Tue, 6 May 2014 12:05:21 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: [PATCH]: vcs_info git: Describe detached heads symbolically. Message-ID: <20140506120521.GC1948@tarsus.local2> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="n8g4imXOkfNTN/H1" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) --n8g4imXOkfNTN/H1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 % ]]] --n8g4imXOkfNTN/H1 Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="0003-vcs_info-git-Try-harder-to-get-a-non-sha1-branch-nam.patch" >>From 0aac472424ca671d2c2715eaac880684ad59c9d6 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf 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 --n8g4imXOkfNTN/H1--