1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-03 22:32:12 +02:00

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.
This commit is contained in:
Daniel Shahaf 2014-04-08 21:07:28 +00:00 committed by Frank Terbeck
parent 0da28f323d
commit 6a201af341
2 changed files with 6 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2014-05-06 Daniel Shahaf <d.s@daniel.shahaf.name>
* 32597: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
vcs_info git: Describe detached heads symbolically.
2014-04-29 Peter Stephenson <p.stephenson@samsung.com>
* Tomoki Sekiyama: 32592: add CORRECT_IGNORE_FILE variable.

View file

@ -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]}..."