1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-08-18 17:20:59 +02:00

Frank: 27679: better logic in VCS_INFO_get_data_git

This commit is contained in:
Peter Stephenson 2010-02-07 18:50:54 +00:00
parent 7da34421c1
commit f8e05427db
2 changed files with 24 additions and 12 deletions
ChangeLog
Functions/VCS_Info/Backends

View file

@ -1,5 +1,9 @@
2010-02-07 Peter Stephenson <p.w.stephenson@ntlworld.com>
* Frank: 27679:
Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
better logic.
* Michael Hwang: 27675: Src/builtin.c: fix crash from error in
has builtin.
@ -12689,5 +12693,5 @@
*****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL
* $Revision: 1.4883 $
* $Revision: 1.4884 $
*****************************************************

View file

@ -54,23 +54,31 @@ VCS_INFO_git_getaction () {
}
VCS_INFO_git_getbranch () {
local gitbranch gitdir=$1
local gitbranch gitdir=$1 tmp actiondir
local gitsymref="${vcs_comm[cmd]} symbolic-ref HEAD"
if [[ -d "${gitdir}/rebase-apply" ]] \
|| [[ -d "${gitdir}/rebase" ]] \
|| [[ -d "${gitdir}/../.dotest" ]] \
|| [[ -f "${gitdir}/MERGE_HEAD" ]] ; then
actiondir=''
for tmp in "${gitdir}/rebase-apply" \
"${gitdir}/rebase" \
"${gitdir}/../.dotest"; do
if [[ -d ${tmp} ]]; then
actiondir=${tmp}
break
fi
done
if [[ -n ${actiondir} ]]; then
gitbranch="$(${(z)gitsymref} 2> /dev/null)"
[[ -z ${gitbranch} ]] && [[ -r ${gitdir}/rebase-apply/head-name ]] \
&& gitbranch="$(< ${gitdir}/rebase-apply/head-name)"
[[ -z ${gitbranch} ]] && [[ -r ${actiondir}/head-name ]] \
&& gitbranch="$(< ${actiondir}/head-name)"
elif [[ -f "${gitdir}/rebase-merge/interactive" ]] \
|| [[ -d "${gitdir}/rebase-merge" ]] ; then
elif [[ -f "${gitdir}/MERGE_HEAD" ]] ; then
gitbranch="$(${(z)gitsymref} 2> /dev/null)"
[[ -z ${gitbranch} ]] && gitbranch="$(< ${gitdir}/MERGE_HEAD)"
elif [[ -d "${gitdir}/rebase-merge" ]] ; then
gitbranch="$(< ${gitdir}/rebase-merge/head-name)"
elif [[ -f "${gitdir}/.dotest-merge/interactive" ]] \
|| [[ -d "${gitdir}/.dotest-merge" ]] ; then
elif [[ -d "${gitdir}/.dotest-merge" ]] ; then
gitbranch="$(< ${gitdir}/.dotest-merge/head-name)"
else