From a94ff2ff6bce6e968e870ff007761d2d17f34fa6 Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Tue, 14 Jul 2015 23:09:32 +0300 Subject: [PATCH] Default to 0 for git rev-list left and right. Fixes #137. --- pure.zsh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pure.zsh b/pure.zsh index af4cd24..e9c58dc 100644 --- a/pure.zsh +++ b/pure.zsh @@ -51,11 +51,14 @@ prompt_pure_check_git_arrows() { # check if there is an upstream configured for this branch command git rev-parse --abbrev-ref @'{u}' &>/dev/null || return - local arrows="" - (( $(command git rev-list --right-only --count HEAD...@'{u}' 2>/dev/null) > 0 )) && arrows="${PURE_GIT_DOWN_ARROW:-⇣}" - (( $(command git rev-list --left-only --count HEAD...@'{u}' 2>/dev/null) > 0 )) && arrows+="${PURE_GIT_UP_ARROW:-⇡}" + local right left arrows + right=$(command git rev-list --right-only --count HEAD...@'{u}' 2>/dev/null) + left=$(command git rev-list --left-only --count HEAD...@'{u}' 2>/dev/null) + + (( ${right:-0} > 0 )) && arrows="${PURE_GIT_DOWN_ARROW:-⇣}" + (( ${left:-0} > 0 )) && arrows+="${PURE_GIT_UP_ARROW:-⇡}" # output the arrows - [[ "$arrows" != "" ]] && echo " ${arrows}" + [[ $arrows != "" ]] && echo " ${arrows}" } prompt_pure_preexec() {