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

[PATCH 2/3] vcs_info/cvs: set vcs_comm[basedir] in VCS_INFO_detect_cvs



---
 Functions/VCS_Info/Backends/VCS_INFO_detect_cvs   | 11 +++++++++--
 Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs |  6 +-----
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/Functions/VCS_Info/Backends/VCS_INFO_detect_cvs b/Functions/VCS_Info/Backends/VCS_INFO_detect_cvs
index 7a5ee1eef..73b79f744 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_detect_cvs
+++ b/Functions/VCS_Info/Backends/VCS_INFO_detect_cvs
@@ -7,5 +7,12 @@ setopt localoptions NO_shwordsplit
 [[ $1 == '--flavours' ]] && return 1
 
 VCS_INFO_check_com ${vcs_comm[cmd]} || return 1
-[[ -d "./CVS" ]] && [[ -r "./CVS/Repository" ]] && return 0
-return 1
+[[ -d "./CVS" ]] && [[ -r "./CVS/Repository" ]] || return 1
+
+local cvsbase="."
+while [[ -d "${cvsbase}/../CVS" ]]; do
+    cvsbase="${cvsbase}/.."
+done
+vcs_comm[basedir]=${cvsbase:P}
+
+return 0
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs b/Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs
index e9d172052..1ca0e9c16 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs
@@ -5,11 +5,7 @@
 setopt localoptions NO_shwordsplit
 local cvsbranch cvsbase
 
-cvsbase="."
-while [[ -d "${cvsbase}/../CVS" ]]; do
-    cvsbase="${cvsbase}/.."
-done
-cvsbase=${cvsbase:P}
+cvsbase=${vcs_comm[basedir]}
 cvsbranch=$(< ./CVS/Repository)
 rrn=${cvsbase:t}
 cvsbranch=${cvsbranch##${rrn}/}
-- 
2.24.0



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