From bc3adb457132d18efac15c83fd36c357e09fdc76 Mon Sep 17 00:00:00 2001 From: Adam Lindberg Date: Wed, 16 Apr 2014 10:34:45 +0200 Subject: [PATCH] Use low level command to detect branches behind Using git log is subject to formatting in .gitconfig, which can be overridden and will break this function. Relying on rev-list is much more stable. --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index 305a77aff..53657bf19 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -54,7 +54,7 @@ git_remote_status() { # Checks if there are commits ahead from remote function git_prompt_ahead() { - if $(echo "$(command git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then + if [[ -n "$(command git rev-list origin/$(current_branch)..HEAD 2> /dev/null)" ]]; then echo "$ZSH_THEME_GIT_PROMPT_AHEAD" fi }