Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH 2/3] vcs_info cvs: Fix infinite loop when /CVS exists.



---
I don't have cvs(1) installed, so I can't test this.  Could someone please
give this a quick test?

Thanks,

Daniel


 Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs b/Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs
index e9d172052..9b828bd11 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs
@@ -5,11 +5,17 @@
 setopt localoptions NO_shwordsplit
 local cvsbranch cvsbase
 
+# Look for the most distant parent that still has a CVS subdirectory.
+# VCS_INFO_detect_cvs ensured that ./CVS/Repository exists.
 cvsbase="."
-while [[ -d "${cvsbase}/../CVS" ]]; do
-    cvsbase="${cvsbase}/.."
-done
 cvsbase=${cvsbase:P}
+while [[ -d "${cvsbase:h}/CVS" ]]; do
+    cvsbase="${cvsbase:h}"
+    if [[ $cvsbase == '/' ]]; then
+        break
+    fi
+done
+
 cvsbranch=$(< ./CVS/Repository)
 rrn=${cvsbase:t}
 cvsbranch=${cvsbranch##${rrn}/}



Messages sorted by: Reverse Date, Date, Thread, Author