summaryrefslogtreecommitdiff
path: root/Functions/VCS_Info
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-10-01 09:44:56 +0100
committerPeter Stephenson <pws@zsh.org>2015-10-01 09:44:56 +0100
commit8877783b2f98de67144f403e0146b6d201e98ba3 (patch)
treec8fe6c4d4fc6d7c93119c01cc300427655001ba3 /Functions/VCS_Info
parent007f249a8e190306a9ef6bca2317e79004ace871 (diff)
parentbc2e73ba4c27a220a6f122cb7b9b5c6fa9996941 (diff)
downloadzsh-8877783b2f98de67144f403e0146b6d201e98ba3.tar.gz
zsh-8877783b2f98de67144f403e0146b6d201e98ba3.zip
Merge branch 'master' of https://git.code.sf.net/p/zsh/code
Diffstat (limited to 'Functions/VCS_Info')
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_git7
1 files changed, 6 insertions, 1 deletions
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index 8ecc7c7f7..8664d510e 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -87,13 +87,18 @@ 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)"
- [[ -z ${gitbranch} ]] && gitbranch="$(< ${gitdir}/MERGE_HEAD)"
+ [[ -z ${gitbranch} ]] && gitbranch="$(< ${gitdir}/ORIG_HEAD)"
elif [[ -d "${gitdir}/rebase-merge" ]] ; then
gitbranch="$(< ${gitdir}/rebase-merge/head-name)"
+ if [[ $gitbranch == 'detached HEAD' ]]; then
+ # get a sha1
+ gitbranch="$(< ${gitdir}/rebase-merge/orig-head)"
+ fi
elif [[ -d "${gitdir}/.dotest-merge" ]] ; then
gitbranch="$(< ${gitdir}/.dotest-merge/head-name)"