Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] vcs_info git: Compute %b correctly with "rebase --onto" of detached heads. (Follow-up to 36725.)



---
Besides .git/ORIG_HEAD there is also .git/rebase-apply/orig-head, I'm
not sure if one of those should be preferred over the other.

 Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index 704c189..e1cee74 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)"
-- 
2.1.4



Messages sorted by: Reverse Date, Date, Thread, Author