diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-21 15:43:45 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-21 15:59:37 +1200 |
commit | 03e4b753cf099b284efca19ceb4fce679cfa5056 (patch) | |
tree | 1c95dea91d0d42a6aeb78f3f85ed39c25064fa5c /bash/bashrc.d/prompt.bash | |
parent | Use dynamic completion if available (diff) | |
download | dotfiles-03e4b753cf099b284efca19ceb4fce679cfa5056.tar.gz dotfiles-03e4b753cf099b284efca19ceb4fce679cfa5056.zip |
Force type for Git ahead/behind counts
Diffstat (limited to 'bash/bashrc.d/prompt.bash')
-rw-r--r-- | bash/bashrc.d/prompt.bash | 10 |
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 || |