From 03e4b753cf099b284efca19ceb4fce679cfa5056 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 21 Aug 2016 15:43:45 +1200 Subject: Force type for Git ahead/behind counts --- bash/bashrc.d/prompt.bash | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'bash/bashrc.d/prompt.bash') diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash index a40ea958..0264b7f9 100644 --- a/bash/bashrc.d/prompt.bash +++ b/bash/bashrc.d/prompt.bash @@ -125,12 +125,14 @@ prompt() { local state # Upstream HEAD has commits after local HEAD; we're "behind" - (($(git rev-list --count 'HEAD..@{u}' 2>/dev/null) > 0)) && - state=${state}'<' + local -i behind + behind=$(git rev-list --count 'HEAD..@{u}' 2>/dev/null) + ((behind)) && state=${state}'<' # Local HEAD has commits after upstream HEAD; we're "ahead" - (($(git rev-list --count '@{u}..HEAD' 2>/dev/null) > 0)) && - state=${state}'>' + local -i ahead + ahead=$(git rev-list --count '@{u}..HEAD' 2>/dev/null) + ((ahead)) && state=${state}'>' # Tracked files are modified git diff-files --quiet || -- cgit v1.2.3