aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-08-21 11:28:03 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-08-21 11:28:03 +1200
commitde8612b71308c3448d2bea3c4cc8c2b6e435744b (patch)
treebffeb82c4d77a29ba24e2a98fbcd682cc23b0cc7
parentResolve an issue with incorrect prompt info (diff)
downloaddotfiles-de8612b71308c3448d2bea3c4cc8c2b6e435744b.tar.gz
dotfiles-de8612b71308c3448d2bea3c4cc8c2b6e435744b.zip
Use terser prompt status flag checks
-rw-r--r--bash/bashrc.d/prompt.bash12
1 files changed, 4 insertions, 8 deletions
diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash
index 3b0578ba..dca34928 100644
--- a/bash/bashrc.d/prompt.bash
+++ b/bash/bashrc.d/prompt.bash
@@ -127,18 +127,14 @@ prompt() {
# Collect symbols representing repository state
local state
- if ! git diff-files --quiet ; then
+ git diff-files --quiet ||
state=${state}!
- fi
- if ! git diff-index --cached --quiet HEAD ; then
+ git diff-index --cached --quiet HEAD ||
state=${state}+
- fi
- if [[ -n $(git ls-files --others --exclude-standard) ]] ; then
+ [[ -n $(git ls-files --others --exclude-standard) ]] &&
state=${state}\?
- fi
- if git rev-parse --quiet --verify refs/stash >/dev/null ; then
+ git rev-parse --quiet --verify refs/stash >/dev/null &&
state=${state}^
- fi
# Print the status in brackets; add a git: prefix only if there
# might be another VCS prompt (because PROMPT_VCS is set)