summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2014-05-25 21:56:26 +0000
committerFrank Terbeck <ft@bewatermyfriend.org>2014-05-29 16:50:07 +0200
commit55d5feed30938da181fbbbef34ad0ae0699714f2 (patch)
tree27c27ce35d27a265479b174aae0ba3ca55357836
parentbb271217fe16bc260a4a7ffa29b674c2a7abbc8e (diff)
downloadzsh-55d5feed30938da181fbbbef34ad0ae0699714f2.tar.gz
zsh-55d5feed30938da181fbbbef34ad0ae0699714f2.zip
32621: vcs_info svn: 'Fix set-branch-format' when in subdirs
The previous code would fail to detect the wcroot with Subversion 1.7+ when cwd is at least two levels below the root (i.e., ../../.svn exists and ../.svn doesn't), and would then pass to the hook the revision and basename of cwd rather than of the wcroot.
-rw-r--r--ChangeLog3
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_svn22
2 files changed, 18 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 33b693247..3dce05e0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,9 @@
* 32619: Functions/VCS_Info/Backends/VCS_INFO_get_data_svn:
vcs_info svn: Use the revision of cwd
+ * 32621: Functions/VCS_Info/Backends/VCS_INFO_get_data_svn:
+ vcs_info svn: 'Fix set-branch-format' when in subdirs
+
2014-05-18 Peter Stephenson <p.w.stephenson@ntlworld.com>
* Jun T: 32616: Src/Builtins/rlimits.c: unnecessary printf
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn
index ae3c49959..e56afee02 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn
@@ -30,13 +30,21 @@ done
cwdinfo=(${(kv)svninfo})
-while [[ -d "${svnbase}/../.svn" ]]; do
- parentinfo=()
- ${vcs_comm[cmd]} info --non-interactive "${svnbase}/.." | while IFS=: read a b; do parentinfo[${a// /_}]="${b## #}"; done
- [[ ${parentinfo[Repository_UUID]} != ${svninfo[Repository_UUID]} ]] && break
- svninfo=(${(kv)parentinfo})
- svnbase="${svnbase}/.."
-done
+# Set svnbase to the wcroot path and svninfo to its `svn info`.
+if (( ${+svninfo[Working_Copy_Root_Path]} )); then
+ # svn 1.7+
+ svnbase=${svninfo[Working_Copy_Root_Path]}
+ ${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
+ parentinfo=()
+ ${vcs_comm[cmd]} info --non-interactive -- "${svnbase}/.." | while IFS=: read a b; do parentinfo[${a// /_}]="${b## #}"; done
+ [[ ${parentinfo[Repository_UUID]} != ${svninfo[Repository_UUID]} ]] && break
+ svninfo=(${(kv)parentinfo})
+ svnbase="${svnbase}/.."
+ done
+fi
svnbase="$(VCS_INFO_realpath ${svnbase})"