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.
This commit is contained in:
David Aguilar 2012-04-01 20:30:24 -07:00
commit fd44dfd03f

View file

@ -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
}