From 6a201af3416ae177a66486e9af500c25a117c91e Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Tue, 8 Apr 2014 21:07:28 +0000 Subject: 32597: 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. --- ChangeLog | 5 +++++ Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 377ae2207..b040b205d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-05-06 Daniel Shahaf + + * 32597: Functions/VCS_Info/Backends/VCS_INFO_get_data_git: + vcs_info git: Describe detached heads symbolically. + 2014-04-29 Peter Stephenson * Tomoki Sekiyama: 32592: add CORRECT_IGNORE_FILE variable. diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index 6512851cc..a48dc390d 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]}..." -- cgit 1.4.1