aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-08-21 15:43:45 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-08-21 15:59:37 +1200
commit03e4b753cf099b284efca19ceb4fce679cfa5056 (patch)
tree1c95dea91d0d42a6aeb78f3f85ed39c25064fa5c
parent04d93adfe06bb12a63463dfc9a2d5734ed556c36 (diff)
downloaddotfiles-03e4b753cf099b284efca19ceb4fce679cfa5056.tar.gz
dotfiles-03e4b753cf099b284efca19ceb4fce679cfa5056.zip
Force type for Git ahead/behind counts
-rw-r--r--bash/bashrc.d/prompt.bash10
1 files changed, 6 insertions, 4 deletions
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 ||