Browse code

This is the correct way to check the return value

James Moore authored on 23/09/2011 at 17:51:20
Showing 1 changed files
... ...
@@ -1,5 +1,5 @@
1 1
 function svn_prompt_info {
2
-    if [[ in_svn == 1 ]]; then
2
+    if [ $(in_svn) ]; then
3 3
         echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\
4 4
 $ZSH_THEME_REPO_NAME_COLOR$(svn_get_repo_name)$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$ZSH_PROMPT_BASE_COLOR"
5 5
     fi
... ...
@@ -13,7 +13,7 @@ function in_svn() {
13 13
 }
14 14
 
15 15
 function svn_get_repo_name {
16
-    if [ in_svn ]; then
16
+    if [ $(in_svn) ]; then
17 17
         svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT
18 18
     
19 19
         svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p" | sed "s/\/.*$//"
... ...
@@ -21,13 +21,13 @@ function svn_get_repo_name {
21 21
 }
22 22
 
23 23
 function svn_get_rev_nr {
24
-    if [ in_svn ]; then
24
+    if [ $(in_svn) ]; then
25 25
         svn info 2> /dev/null | sed -n s/Revision:\ //p
26 26
     fi
27 27
 }
28 28
 
29 29
 function svn_dirty_choose {
30
-    if [ in_svn ]; then
30
+    if [ $(in_svn) ]; then
31 31
         s=$(svn status|grep -E '^\s*[ACDIM!?L]' 2>/dev/null)
32 32
         if [ $s ]; then 
33 33
             echo $1