diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-21 11:28:03 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-21 11:28:03 +1200 |
commit | de8612b71308c3448d2bea3c4cc8c2b6e435744b (patch) | |
tree | bffeb82c4d77a29ba24e2a98fbcd682cc23b0cc7 /bash/bashrc.d/prompt.bash | |
parent | Resolve an issue with incorrect prompt info (diff) | |
download | dotfiles-de8612b71308c3448d2bea3c4cc8c2b6e435744b.tar.gz dotfiles-de8612b71308c3448d2bea3c4cc8c2b6e435744b.zip |
Use terser prompt status flag checks
Diffstat (limited to 'bash/bashrc.d/prompt.bash')
-rw-r--r-- | bash/bashrc.d/prompt.bash | 12 |
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) |