1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-11-15 13:34:18 +01:00

36725: vcs_info git: Compute %b correctly when "git am"-ing onto detached heads.

Before this patch, $gitbranch would be set to empty, which caused
VCS_INFO_get_data_git to early out with a failure status¹, consequently
$vcs_info_msg_0_ would be empty.

¹ via the 'if [[ -z ]]' block around line 170.
This commit is contained in:
Daniel Shahaf 2015-09-30 14:21:59 +00:00
parent cd1cda9d57
commit a90cf551ef
2 changed files with 5 additions and 0 deletions

@ -1,5 +1,9 @@
2015-09-30 Daniel Shahaf <d.s@daniel.shahaf.name>
* 36725: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
vcs_info git: Compute %b correctly when "git am"-ing onto
detached heads.
* 36725: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
vcs_info git: Compute %b correctly when rebasing detached heads.

@ -87,6 +87,7 @@ VCS_INFO_git_getbranch () {
gitbranch="$(${(z)gitsymref} 2> /dev/null)"
[[ -z ${gitbranch} ]] && [[ -r ${actiondir}/head-name ]] \
&& gitbranch="$(< ${actiondir}/head-name)"
[[ -z ${gitbranch} ]] && gitbranch="$(< ${gitdir}/ORIG_HEAD)"
elif [[ -f "${gitdir}/MERGE_HEAD" ]] ; then
gitbranch="$(${(z)gitsymref} 2> /dev/null)"