From 79e620c392393f254d9614b18963af1c9ac234e7 Mon Sep 17 00:00:00 2001 From: Drarok Ithaqua Date: Tue, 27 Nov 2012 12:03:51 +0000 Subject: [PATCH 1/2] Whitespace cleanup. --- plugins/svn/svn.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh index bd2767e3e..142ac3bd3 100644 --- a/plugins/svn/svn.plugin.zsh +++ b/plugins/svn/svn.plugin.zsh @@ -15,7 +15,7 @@ function in_svn() { function svn_get_repo_name { if [ $(in_svn) ]; then svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT - + svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p" fi } @@ -31,7 +31,7 @@ function svn_dirty_choose { svn status 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]' if [ $pipestatus[-1] -ne 0 ]; then echo $1 - else + else echo $2 fi fi From 120db35b2dd7792b981401f66323e8886668c909 Mon Sep 17 00:00:00 2001 From: Drarok Ithaqua Date: Tue, 27 Nov 2012 12:08:18 +0000 Subject: [PATCH 2/2] Fix the backwards svn status, and add comments explaining which way grep does things. --- plugins/svn/svn.plugin.zsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh index 142ac3bd3..79c8bdcdf 100644 --- a/plugins/svn/svn.plugin.zsh +++ b/plugins/svn/svn.plugin.zsh @@ -1,3 +1,4 @@ + function svn_prompt_info { if [ $(in_svn) ]; then echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\ @@ -29,9 +30,11 @@ function svn_get_rev_nr { function svn_dirty_choose { if [ $(in_svn) ]; then svn status 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]' - if [ $pipestatus[-1] -ne 0 ]; then + if [ $pipestatus[-1] -eq 0 ]; then + # Grep exits with 0 when "One or more lines were selected", return "dirty". echo $1 else + # Otherwise, no lines were found, or an error occurred. Return clean. echo $2 fi fi