From 939bffe4e4a141326b42b5799f3fa365b09295f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Rath=C3=A9?= Date: Tue, 28 Feb 2012 17:10:54 -0500 Subject: [PATCH] Enhance the way git looks for commits ahead. --- lib/git.zsh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/git.zsh b/lib/git.zsh index fb4ad8ca6..eebaf467f 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -19,11 +19,10 @@ parse_git_dirty() { } -# Checks if there are commits ahead from remote +# Checks if there are commits ahead the upstream (the tracked remote branch) function git_prompt_ahead() { - if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then - echo "$ZSH_THEME_GIT_PROMPT_AHEAD" - fi + local cherries=$(git cherry @{upstream}) 2> /dev/null + [ $cherries ] && echo "$ZSH_THEME_GIT_PROMPT_AHEAD" } # Formats prompt string for current git commit short SHA