From de8612b71308c3448d2bea3c4cc8c2b6e435744b Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 21 Aug 2016 11:28:03 +1200 Subject: Use terser prompt status flag checks --- bash/bashrc.d/prompt.bash | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'bash/bashrc.d') 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) -- cgit v1.2.3