aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/prompt.bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2013-09-17 13:06:06 +1200
committerTom Ryder <tom@sanctum.geek.nz>2013-09-17 13:06:06 +1200
commitb1d4db6bf5d2b346dcb3f6a169d91a20d05da110 (patch)
tree8dc1eff677cfc764159262aca21dcae134984a88 /bash/bashrc.d/prompt.bash
parentForgot to make two vars local (diff)
downloaddotfiles-b1d4db6bf5d2b346dcb3f6a169d91a20d05da110.tar.gz
dotfiles-b1d4db6bf5d2b346dcb3f6a169d91a20d05da110.zip
Improve status parsing for SVN a bit
Diffstat (limited to 'bash/bashrc.d/prompt.bash')
-rw-r--r--bash/bashrc.d/prompt.bash23
1 files changed, 18 insertions, 5 deletions
diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash
index 42771c0b..1ad239d9 100644
--- a/bash/bashrc.d/prompt.bash
+++ b/bash/bashrc.d/prompt.bash
@@ -168,14 +168,27 @@ prompt() {
branch=${branch#branches/}
branch=${branch%%/*}
- # Start collecting working copy state flags
- local -a state
+ # Parse the output of svn info to determine working copy state
+ local symbol new modified
+ while read -r symbol _; do
+ case $symbol in
+ *'?'*)
+ new=1
+ ;;
+ *)
+ modified=1
+ ;;
+ esac
+ done < <(svn status 2>/dev/null)
- # If there are changes in the working directory, add an exclamation
- # mark to the state
- if [[ $(svn status 2>/dev/null) ]]; then
+ # Add appropriate state flags
+ local -a state
+ if [[ $modified ]]; then
state=("${state[@]}" '!')
fi
+ if [[ $new ]]; then
+ state=("${state[@]}" '?')
+ fi
# Print the state in brackets with an svn: prefix
printf '(svn:%s%s)' \