diff options
Diffstat (limited to 'zshfunc/vcs-info/VCS_INFO_git_getaction')
-rw-r--r-- | zshfunc/vcs-info/VCS_INFO_git_getaction | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/zshfunc/vcs-info/VCS_INFO_git_getaction b/zshfunc/vcs-info/VCS_INFO_git_getaction new file mode 100644 index 0000000..3593f28 --- /dev/null +++ b/zshfunc/vcs-info/VCS_INFO_git_getaction @@ -0,0 +1,47 @@ +VCS_INFO_git_getaction () { #{{{ + local gitaction='' gitdir=$1 + local tmp + + for tmp in "${gitdir}/rebase-apply" \ + "${gitdir}/rebase" \ + "${gitdir}/../.dotest" ; do + if [[ -d ${tmp} ]] ; then + if [[ -f "${tmp}/rebasing" ]] ; then + gitaction="rebase" + elif [[ -f "${tmp}/applying" ]] ; then + gitaction="am" + else + gitaction="am/rebase" + fi + printf '%s' ${gitaction} + return 0 + fi + done + + for tmp in "${gitdir}/rebase-merge/interactive" \ + "${gitdir}/.dotest-merge/interactive" ; do + if [[ -f "${tmp}" ]] ; then + printf '%s' "rebase-i" + return 0 + fi + done + + for tmp in "${gitdir}/rebase-merge" \ + "${gitdir}/.dotest-merge" ; do + if [[ -d "${tmp}" ]] ; then + printf '%s' "rebase-m" + return 0 + fi + done + + if [[ -f "${gitdir}/MERGE_HEAD" ]] ; then + printf '%s' "merge" + return 0 + fi + + if [[ -f "${gitdir}/BISECT_LOG" ]] ; then + printf '%s' "bisect" + return 0 + fi + return 1 +} |