fix git-prompt bug where the INDEX would appear dirty if you had an unmerged change.

ashleydev.zsh-theme: add bold yellow to branch color if unmerged state preset; overrides the red dirty color.
This commit is contained in:
Ashley Dev 2011-11-30 10:04:41 -08:00
commit 8a013666f0
2 changed files with 4 additions and 1 deletions

View file

@ -192,7 +192,6 @@ git_prompt__dirty_state ()
if [[ "$line" = UU* ]]; then if [[ "$line" = UU* ]]; then
GIT_PROMPT_DIRTY_STATE_INDEX_UNMERGED='yes' GIT_PROMPT_DIRTY_STATE_INDEX_UNMERGED='yes'
GIT_PROMPT_DIRTY_STATE_INDEX_DIRTY='yes'
GIT_PROMPT_DIRTY_STATE_ANY_DIRTY='yes' GIT_PROMPT_DIRTY_STATE_ANY_DIRTY='yes'
fi fi
done < <(git status --porcelain 2> /dev/null) done < <(git status --porcelain 2> /dev/null)

View file

@ -21,6 +21,7 @@ if [[ "$DISABLE_COLOR" != "true" ]]; then
local _Cerror_="%{$fg[yellow]%}" # bad (empty) .git/ directory local _Cerror_="%{$fg[yellow]%}" # bad (empty) .git/ directory
local _Cbranch_new_repo_="%{$fg_bold[default]%}" # branch color of new repo local _Cbranch_new_repo_="%{$fg_bold[default]%}" # branch color of new repo
local _Cbranch_clean_="%{$fg_no_bold[green]%}" # branch color when clean local _Cbranch_clean_="%{$fg_no_bold[green]%}" # branch color when clean
local _Cbranch_unmerged_="%{$fg_bold[yellow]%}" # branch color when clean
local _Cbranch_dirty_="%{$fg_no_bold[red]%}" # branch color when dirty local _Cbranch_dirty_="%{$fg_no_bold[red]%}" # branch color when dirty
local _Crebase_="%{$bold_color$fg[yellow]%}" # rebase info local _Crebase_="%{$bold_color$fg[yellow]%}" # rebase info
local _Cindex_="%{$bold_color$fg[red]%}" # index info local _Cindex_="%{$bold_color$fg[red]%}" # index info
@ -99,6 +100,7 @@ git_prompt_info ()
local index_=$GIT_PROMPT_DIRTY_STATE_INDEX_DIRTY local index_=$GIT_PROMPT_DIRTY_STATE_INDEX_DIRTY
local untracked_=$GIT_PROMPT_DIRTY_STATE_WORKTREE_UNTRACKED local untracked_=$GIT_PROMPT_DIRTY_STATE_WORKTREE_UNTRACKED
local freshy_=$GIT_PROMPT_DIRTY_STATE_FRESH_REPO local freshy_=$GIT_PROMPT_DIRTY_STATE_FRESH_REPO
local unmerged_=$GIT_PROMPT_DIRTY_STATE_INDEX_UNMERGED
if [ -z "$branch_$index_$work_$untracked_" ]; then if [ -z "$branch_$index_$work_$untracked_" ]; then
if [ -n "$dir_" ]; then if [ -n "$dir_" ]; then
@ -127,6 +129,8 @@ git_prompt_info ()
if [ "$freshy_" = "yes" ]; then if [ "$freshy_" = "yes" ]; then
# this is a fresh repo, nothing here... # this is a fresh repo, nothing here...
branch_="$_Cbranch_new_repo_$branch_$R" branch_="$_Cbranch_new_repo_$branch_$R"
elif [ "$unmerged_" = 'yes' ]; then
branch_="$_Cbranch_unmerged_$branch_$R"
elif [ "$work_" = 'yes' ]; then elif [ "$work_" = 'yes' ]; then
branch_="$_Cbranch_dirty_$branch_$R" branch_="$_Cbranch_dirty_$branch_$R"
elif [ "$work_" = 'no' ]; then elif [ "$work_" = 'no' ]; then