From fd44dfd03f46eea40975b96375c3f392f191dd27 Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Sun, 1 Apr 2012 20:30:24 -0700 Subject: [PATCH] lib/git.zsh: Speed-up git_prompt_ahead() Use the `git rev-list` plumbing instead of `git log`, which allows us to do without grep. Limit the history to one commit as well. --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index 148695643..444b30f3d 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -57,7 +57,7 @@ git_remote_status() { # Checks if there are commits ahead from remote function git_prompt_ahead() { - if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then + if [[ -n $(git rev-list -1 origin/$(current_branch)..HEAD 2>/dev/null) ]]; then echo "$ZSH_THEME_GIT_PROMPT_AHEAD" fi }