zsh-workers
 help / color / Atom feed
From: Daniel Shahaf <danielsh@apache.org>
To: zsh-workers@zsh.org
Subject: [PATCH 2/3] vcs_info cvs: Fix infinite loop when /CVS exists.
Date: Sun,  1 Dec 2019 00:04:47 +0000
Message-ID: <20191201000448.21880-2-danielsh@apache.org> (raw)
In-Reply-To: <20191201000448.21880-1-danielsh@apache.org>

---
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}/}

  reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-01  0:04 [PATCH 1/3] vcs_info: Document internal function and variable Daniel Shahaf
2019-12-01  0:04 ` Daniel Shahaf [this message]
2019-12-01  0:04 ` [PATCH 3/3] vcs_info svn: Fix infinite loop when /.svn exists Daniel Shahaf

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191201000448.21880-2-danielsh@apache.org \
    --to=danielsh@apache.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

zsh-workers

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-workers

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git