36fea45bfc564c667007421a643df38c02235c8b

Author
Andrew Janke <andrew@apjanke.net>
Committer
Andrew Janke <andrew@apjanke.net>
Date

Message

svn plugin: urldecode repo info

The repo location reported by `svn` is a URL. If you don't decode it before using it a prompt, the `%` sequences will be misinterpreted by prompt expansion and give screwy results.
Fixes #2233

Diff

 1diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh
 2index 9f7a4c6eb4721c57b5f6c1b710a052b494248dc9..816055afe956311ee22ca2b564bb7eb521b3a526 100644
 3--- a/plugins/svn/svn.plugin.zsh
 4+++ b/plugins/svn/svn.plugin.zsh
 5@@ -1,16 +1,17 @@
 6 # vim:ft=zsh ts=2 sw=2 sts=2
 7 #
 8 function svn_prompt_info() {
 9+  local _DISPLAY
10   if in_svn; then
11     if [ "x$SVN_SHOW_BRANCH" = "xtrue" ]; then
12       unset SVN_SHOW_BRANCH
13       _DISPLAY=$(svn_get_branch_name)
14     else
15       _DISPLAY=$(svn_get_repo_name)
16+      _DISPLAY=$(omz_urldecode "${_DISPLAY}")
17     fi
18     echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\
19 $ZSH_THEME_REPO_NAME_COLOR$_DISPLAY$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$(svn_dirty_pwd)$ZSH_PROMPT_BASE_COLOR"
20-    unset _DISPLAY
21   fi
22 }
23 
24@@ -30,7 +31,7 @@ function svn_get_repo_name() {
25 }
26 
27 function svn_get_branch_name() {
28-  _DISPLAY=$(
29+  local _DISPLAY=$(
30     svn info 2> /dev/null | \
31       awk -F/ \
32       '/^URL:/ { \
33@@ -49,7 +50,6 @@ function svn_get_branch_name() {
34   else
35     echo $_DISPLAY
36   fi
37-  unset _DISPLAY
38 }
39 
40 function svn_get_rev_nr() {
41@@ -60,7 +60,7 @@ function svn_get_rev_nr() {
42 
43 function svn_dirty_choose() {
44   if in_svn; then
45-    root=`svn info 2> /dev/null | sed -n 's/^Working Copy Root Path: //p'`
46+    local root=`svn info 2> /dev/null | sed -n 's/^Working Copy Root Path: //p'`
47     if $(svn status $root 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'); then
48       # Grep exits with 0 when "One or more lines were selected", return "dirty".
49       echo $1
50@@ -77,7 +77,7 @@ function svn_dirty() {
51 
52 function svn_dirty_choose_pwd () {
53   if in_svn; then
54-    root=$PWD
55+    local root=$PWD
56     if $(svn status $root 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'); then
57       # Grep exits with 0 when "One or more lines were selected", return "dirty".
58       echo $1