Add function to display if there is a rebase, merge or bisect going on on the prompt

This commit is contained in:
Mario Fernandez 2012-01-17 12:17:38 +01:00
commit 600975cec7

View file

@ -62,3 +62,22 @@ git_prompt_status() {
fi fi
echo $STATUS echo $STATUS
} }
# Checks if there is a bisect, merge or rebase currently going on
git_prompt_rebase_state() {
STATUS=""
if [ -f ".git/BISECT_LOG" ] ; then
STATUS="$ZSH_THEME_GIT_PROMPT_STATE_BEFORE$ZSH_THEME_GIT_PROMPT_STATE_BISECT"
elif [ -f ".git/MERGE_HEAD" ] ; then
STATUS="$ZSH_THEME_GIT_PROMPT_STATE_BEFORE$ZSH_THEME_GIT_PROMPT_STATE_MERGE"
else
for dir in rebase rebase-apply rebase-merge ; do
if [ -d ".git/$dir" ] ; then
STATUS="$ZSH_THEME_GIT_PROMPT_STATE_BEFORE$ZSH_THEME_GIT_PROMPT_STATE_REBASE"
break
fi
done
fi
echo $STATUS
}