Default to 0 for git rev-list left and right. Fixes #137.

This commit is contained in:
Mathias Fredriksson
2015-07-14 23:09:32 +03:00
parent 579af2425b
commit a94ff2ff6b

View File

@@ -51,11 +51,14 @@ prompt_pure_check_git_arrows() {
# check if there is an upstream configured for this branch # check if there is an upstream configured for this branch
command git rev-parse --abbrev-ref @'{u}' &>/dev/null || return command git rev-parse --abbrev-ref @'{u}' &>/dev/null || return
local arrows="" local right left arrows
(( $(command git rev-list --right-only --count HEAD...@'{u}' 2>/dev/null) > 0 )) && arrows="${PURE_GIT_DOWN_ARROW:-}" right=$(command git rev-list --right-only --count HEAD...@'{u}' 2>/dev/null)
(( $(command git rev-list --left-only --count HEAD...@'{u}' 2>/dev/null) > 0 )) && arrows+="${PURE_GIT_UP_ARROW:-}" 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 # output the arrows
[[ "$arrows" != "" ]] && echo " ${arrows}" [[ $arrows != "" ]] && echo " ${arrows}"
} }
prompt_pure_preexec() { prompt_pure_preexec() {