summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Shahaf <danielsh@apache.org>2019-12-01 00:04:48 +0000
committerDaniel Shahaf <danielsh@apache.org>2019-12-03 02:56:02 +0000
commit9e771a0b203ad9cc953b42111da55207304cdc19 (patch)
tree51fb1a9b004d9bcbb34e84cd54ff9abcc1493af7
parentce950dd4b4b56e39a5011c54179832ba2ed04e61 (diff)
downloadzsh-9e771a0b203ad9cc953b42111da55207304cdc19.tar.gz
zsh-9e771a0b203ad9cc953b42111da55207304cdc19.tar.xz
zsh-9e771a0b203ad9cc953b42111da55207304cdc19.zip
44961: vcs_info svn: Fix infinite loop when /.svn exists.
-rw-r--r--ChangeLog3
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_svn12
2 files changed, 10 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index b040dd09b..3469ad643 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2019-12-03  Daniel Shahaf  <danielsh@apache.org>
 
+	* 44961: Functions/VCS_Info/Backends/VCS_INFO_get_data_svn:
+	vcs_info svn: Fix infinite loop when /.svn exists.
+
 	* 44962: Functions/VCS_Info/VCS_INFO_bydir_detect,
 	Functions/VCS_Info/vcs_info: vcs_info: Document internal function
 	and variable
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn
index c1547950f..21590addd 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn
@@ -46,17 +46,19 @@ if (( ${+svninfo[Working_Copy_Root_Path]} )); then
   ${vcs_comm[cmd]} info --non-interactive -- "${svnbase}" | while IFS=: read a b; do svninfo[${a// /_}]="${b## #}"; done
 else
   # svn 1.0-1.6
-  while [[ -d "${svnbase}/../.svn" ]]; do
+  svnbase=${svnbase:P}
+  while [[ -d "${svnbase:h}/.svn" ]]; do
       parentinfo=()
-      ${vcs_comm[cmd]} info --non-interactive -- "${svnbase}/.." | while IFS=: read a b; do parentinfo[${a// /_}]="${b## #}"; done
+      ${vcs_comm[cmd]} info --non-interactive -- "${svnbase:h}" | while IFS=: read a b; do parentinfo[${a// /_}]="${b## #}"; done
       [[ ${parentinfo[Repository_UUID]} != ${svninfo[Repository_UUID]} ]] && break
       svninfo=(${(kv)parentinfo})
-      svnbase="${svnbase}/.."
+      svnbase=${svnbase:h}
+      if [[ $svnbase == '/' ]]; then
+	  break
+      fi
   done
 fi
 
-svnbase=${svnbase:P}
-
 rrn=${svnbase:t}
 zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" branchformat svnbranch || svnbranch="%b:%r"
 hook_com=( branch "${svninfo[URL]##*/}" revision "${cwdinfo[Revision]}" )