summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_git3
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index e23364272..8b6b61661 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2015-11-30  Daniel Shahaf  <d.s@daniel.shahaf.name>
 
+	* 37252: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
+	vcs_info git: Compute %b correctly with "rebase --onto" of
+	detached heads. (Follow-up to 36725.)
+
 	* 37254: Src/params.c: No functional change: change code layout
 	in preparation for 37253.
 
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index 704c1890e..e1cee7439 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -87,7 +87,8 @@ 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)"
+        [[ -z ${gitbranch} || ${gitbranch} == 'detached HEAD' ]] \
+            && gitbranch="$(< ${gitdir}/ORIG_HEAD)"
 
     elif [[ -f "${gitdir}/MERGE_HEAD" ]] ; then
         gitbranch="$(${(z)gitsymref} 2> /dev/null)"