From 8a013666f0d6909f422399f2c31772b6ac8ab6d8 Mon Sep 17 00:00:00 2001 From: Ashley Dev Date: Wed, 30 Nov 2011 10:04:41 -0800 Subject: [PATCH] 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. --- plugins/git/git-prompt.plugin.zsh | 1 - themes/ashleydev.zsh-theme | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/git/git-prompt.plugin.zsh b/plugins/git/git-prompt.plugin.zsh index 6984397d8..caf64fb16 100644 --- a/plugins/git/git-prompt.plugin.zsh +++ b/plugins/git/git-prompt.plugin.zsh @@ -192,7 +192,6 @@ git_prompt__dirty_state () if [[ "$line" = UU* ]]; then GIT_PROMPT_DIRTY_STATE_INDEX_UNMERGED='yes' - GIT_PROMPT_DIRTY_STATE_INDEX_DIRTY='yes' GIT_PROMPT_DIRTY_STATE_ANY_DIRTY='yes' fi done < <(git status --porcelain 2> /dev/null) diff --git a/themes/ashleydev.zsh-theme b/themes/ashleydev.zsh-theme index 29680a88d..a24a795bb 100644 --- a/themes/ashleydev.zsh-theme +++ b/themes/ashleydev.zsh-theme @@ -21,6 +21,7 @@ if [[ "$DISABLE_COLOR" != "true" ]]; then local _Cerror_="%{$fg[yellow]%}" # bad (empty) .git/ directory 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_unmerged_="%{$fg_bold[yellow]%}" # branch color when clean local _Cbranch_dirty_="%{$fg_no_bold[red]%}" # branch color when dirty local _Crebase_="%{$bold_color$fg[yellow]%}" # rebase 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 untracked_=$GIT_PROMPT_DIRTY_STATE_WORKTREE_UNTRACKED local freshy_=$GIT_PROMPT_DIRTY_STATE_FRESH_REPO + local unmerged_=$GIT_PROMPT_DIRTY_STATE_INDEX_UNMERGED if [ -z "$branch_$index_$work_$untracked_" ]; then if [ -n "$dir_" ]; then @@ -127,6 +129,8 @@ git_prompt_info () if [ "$freshy_" = "yes" ]; then # this is a fresh repo, nothing here... branch_="$_Cbranch_new_repo_$branch_$R" + elif [ "$unmerged_" = 'yes' ]; then + branch_="$_Cbranch_unmerged_$branch_$R" elif [ "$work_" = 'yes' ]; then branch_="$_Cbranch_dirty_$branch_$R" elif [ "$work_" = 'no' ]; then