about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2015-09-30 14:21:59 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2015-09-30 21:43:37 +0000
commita90cf551efc92184ab25da25b837296d1c4edc8a (patch)
treeec2559a3b204325721a02f013d5f6de796332701
parentcd1cda9d57ff9f44d285bcd867721c4024500837 (diff)
downloadzsh-a90cf551efc92184ab25da25b837296d1c4edc8a.tar.gz
zsh-a90cf551efc92184ab25da25b837296d1c4edc8a.tar.xz
zsh-a90cf551efc92184ab25da25b837296d1c4edc8a.zip
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.
-rw-r--r--ChangeLog4
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_git1
2 files changed, 5 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index f45b414c0..20860a1f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
 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.
 
 	* 36725: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index 0a2a8bc37..8664d510e 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -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)"