about summary refs log tree commit diff
path: root/Functions/VCS_Info/Backends/VCS_INFO_detect_cvs
diff options
context:
space:
mode:
authorAleksandr Mezin <mezin.alexander@gmail.com>2021-03-29 15:53:44 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2021-03-29 17:03:40 +0000
commitfc82e8193bad79db5de9e40ec99814fe401ad876 (patch)
tree5b4a8c7992a255e6cca8bfd6060a01e2830d533b /Functions/VCS_Info/Backends/VCS_INFO_detect_cvs
parent2ffd2928336154cf38ee390db835f25c685fe713 (diff)
downloadzsh-fc82e8193bad79db5de9e40ec99814fe401ad876.tar.gz
zsh-fc82e8193bad79db5de9e40ec99814fe401ad876.tar.xz
zsh-fc82e8193bad79db5de9e40ec99814fe401ad876.zip
47561 (the git and cvs parts) (compare 44919 + 44920): vcs_info internals: cvs, git: Set ${vcs_comm[basedir]} like all other backends do.
That doesn't affect anything, not even other vcs_info internals; it's
just for consistency across backends.
Diffstat (limited to 'Functions/VCS_Info/Backends/VCS_INFO_detect_cvs')
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_detect_cvs17
1 files changed, 15 insertions, 2 deletions
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_detect_cvs b/Functions/VCS_Info/Backends/VCS_INFO_detect_cvs
index 7a5ee1eef..a57959ec9 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_detect_cvs
+++ b/Functions/VCS_Info/Backends/VCS_INFO_detect_cvs
@@ -7,5 +7,18 @@ 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
+if ! [[ -d "./CVS" ]] || ! [[ -r "./CVS/Repository" ]] ; then
+    return 1
+fi
+
+# Look for the most distant parent that still has a CVS subdirectory.
+local cvsbase="."
+cvsbase=${cvsbase:P}
+while [[ -d "${cvsbase:h}/CVS" ]]; do
+    cvsbase="${cvsbase:h}"
+    if [[ $cvsbase == '/' ]]; then
+        break
+    fi
+done
+
+vcs_comm[basedir]="${cvsbase}"