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 [thread overview]
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}/}
next prev parent reply other threads:[~2019-12-01 0:05 UTC|newest]
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 publicly 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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).