1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-11 00:10:08 +00:00

Added git mode support for merging, rebasing, and bisecting

<B> Designates Bisecting
>M< Designates Merging
>R> Designates Rebasing
This commit is contained in:
tcasparro 2014-03-20 16:09:45 -07:00 committed by redsunsoft
parent ffc17b6b4d
commit 53323abdb1

View file

@ -69,7 +69,9 @@ prompt_context() {
# Git: branch/detached head, dirty status
prompt_git() {
local ref dirty
local ref dirty mode repo_path
repo_path=$(git rev-parse --git-dir 2>/dev/null)
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
dirty=$(parse_git_dirty)
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git show-ref --head -s --abbrev |head -n1 2> /dev/null)"
@ -79,6 +81,14 @@ prompt_git() {
prompt_segment green black
fi
if [[ -e "${repo_path}/BISECT_LOG" ]]; then
mode=" <B>"
elif [[ -e "${repo_path}/MERGE_HEAD" ]]; then
mode=" >M<"
elif [[ -e "${repo_path}/rebase" || -e "${repo_path}/rebase-apply" || -e "${repo_path}/rebase-merge" || -e "${repo_path}/../.dotest" ]]; then
mode=" >R>"
fi
setopt promptsubst
autoload -Uz vcs_info
@ -90,7 +100,7 @@ prompt_git() {
zstyle ':vcs_info:*' formats ' %u%c'
zstyle ':vcs_info:*' actionformats ' %u%c'
vcs_info
echo -n "${ref/refs\/heads\// }${vcs_info_msg_0_%% }"
echo -n "${ref/refs\/heads\// }${vcs_info_msg_0_%% }${mode}"
fi
}