From 61262ae2821d375929bd418b6acc8d253bfb2faa Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sun, 1 Dec 2019 00:04:47 +0000 Subject: 44960: vcs_info cvs: Fix infinite loop when /CVS exists. --- ChangeLog | 3 +++ Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs | 12 +++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3469ad643..a2b2f3073 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2019-12-03 Daniel Shahaf + * 44960: Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs: + vcs_info cvs: Fix infinite loop when /CVS exists. + * 44961: Functions/VCS_Info/Backends/VCS_INFO_get_data_svn: vcs_info svn: Fix infinite loop when /.svn exists. 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}/} -- cgit 1.4.1