diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2013-09-17 13:06:06 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2013-09-17 13:06:06 +1200 |
commit | b1d4db6bf5d2b346dcb3f6a169d91a20d05da110 (patch) | |
tree | 8dc1eff677cfc764159262aca21dcae134984a88 /bash | |
parent | Forgot to make two vars local (diff) | |
download | dotfiles-b1d4db6bf5d2b346dcb3f6a169d91a20d05da110.tar.gz dotfiles-b1d4db6bf5d2b346dcb3f6a169d91a20d05da110.zip |
Improve status parsing for SVN a bit
Diffstat (limited to 'bash')
-rw-r--r-- | bash/bashrc.d/prompt.bash | 23 |
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)' \ |