Make untracked in prompt behave how I want

This commit is contained in:
Wesley Moore 2010-04-01 09:42:06 +11:00
commit c31592c601

View file

@ -5,18 +5,14 @@ function git_prompt_info() {
}
parse_git_dirty () {
gitstat=$(git status 2>/dev/null | grep '\(# Untracked\|# Changes\|# Changed but not updated:\)')
gitstat=$(git status 2> /dev/null | tail -n1)
if [[ $(echo ${gitstat} | grep -c "^# Changes to be committed:$") > 0 ]]; then
echo -n "$ZSH_THEME_GIT_PROMPT_DIRTY"
fi
if [[ $(echo ${gitstat} | grep -c "^\(# Untracked files:\|# Changed but not updated:\)$") > 0 ]]; then
echo -n "$ZSH_THEME_GIT_PROMPT_UNTRACKED"
fi
if [[ $(echo ${gitstat} | wc -l | tr -d ' ') == 0 ]]; then
echo -n "$ZSH_THEME_GIT_PROMPT_CLEAN"
if [[ $(echo ${gitstat} | grep -c "nothing added to commit but untracked files present") > 0 ]]; then
echo "$ZSH_THEME_GIT_PROMPT_UNTRACKED"
elif [[ ${gitstat} != "nothing to commit (working directory clean)" ]]; then
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
else
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
fi
}