2aa485ac04016493fcf0c95656609f237f3ada1f

Author
Robby Russell <robby@planetargon.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Merge pull request #1435 from Drarok/fix-svn

Fix backwards svn "dirty" state detection

Diff

 1diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh
 2index 7ae3897afe7f36601bfb5238c4db68e9ad047ab9..e38e8920b92d9482dff4e676a8a576480d7e7964 100644
 3--- a/plugins/svn/svn.plugin.zsh
 4+++ b/plugins/svn/svn.plugin.zsh
 5@@ -1,3 +1,4 @@
 6+
 7 function svn_prompt_info {
 8     if [ $(in_svn) ]; then
 9         if [ "x$SVN_SHOW_BRANCH" = "xtrue" ]; then
10@@ -22,7 +23,7 @@ function in_svn() {
11 function svn_get_repo_name {
12     if [ $(in_svn) ]; then
13         svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT
14-    
15+
16         svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p"
17     fi
18 }
19@@ -46,9 +47,11 @@ function svn_get_rev_nr {
20 function svn_dirty_choose {
21     if [ $(in_svn) ]; then
22         svn status 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]'
23-        if [ $pipestatus[-1] -ne 0 ]; then
24+        if [ $pipestatus[-1] -eq 0 ]; then
25+            # Grep exits with 0 when "One or more lines were selected", return "dirty".
26             echo $1
27-        else 
28+        else
29+            # Otherwise, no lines were found, or an error occurred. Return clean.
30             echo $2
31         fi
32     fi