From: Junio C Hamano <gitster@pobox.com>
To: Petr Baudis <pasky@suse.cz>
Cc: git@vger.kernel.org, "Shawn O. Pearce" <spearce@spearce.org>
Subject: [PATCH] Fix reading of cloud tags
Date: Tue, 14 Oct 2008 21:27:12 -0700 [thread overview]
Message-ID: <7v1vyi5vq7.fsf_-_@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20081014000812.GZ4856@spearce.org> (Shawn O. Pearce's message of "Mon, 13 Oct 2008 17:08:12 -0700")
The projectroot path could have SP in it, in which case iterating over
<$git_dir/ctags/*> does not correctly enumerate the cloud tags files at
all.
This can be observed by creating an empty t/trash directory and running
t9500 test. The $projectroot ends with "trash directory.t9500-gitweb-/"
and <$glob> would give "trash", which can be opened and reading from it
immediately yields undef, which in turn gives an undef value warning to
the standard error stream upon attempt to chomp it.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
gitweb/gitweb.perl | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git c/gitweb/gitweb.perl w/gitweb/gitweb.perl
index 1116800..577c041 100755
--- c/gitweb/gitweb.perl
+++ w/gitweb/gitweb.perl
@@ -1805,7 +1805,8 @@ sub git_get_project_ctags {
my $ctags = {};
$git_dir = "$projectroot/$path";
- foreach (<$git_dir/ctags/*>) {
+ opendir D, "$git_dir/ctags";
+ foreach (grep { -f $_ } map { "$git_dir/ctags/$_" } readdir(D)) {
open CT, $_ or next;
my $val = <CT>;
chomp $val;
@@ -1813,6 +1814,7 @@ sub git_get_project_ctags {
my $ctag = $_; $ctag =~ s#.*/##;
$ctags->{$ctag} = $val;
}
+ closedir D;
$ctags;
}
next prev parent reply other threads:[~2008-10-15 4:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-13 23:40 Puzzled by a t9500 test failure Junio C Hamano
2008-10-13 23:48 ` Shawn O. Pearce
2008-10-14 0:08 ` Shawn O. Pearce
2008-10-15 4:27 ` Junio C Hamano [this message]
2008-10-14 0:13 ` Junio C Hamano
2008-10-14 0:22 ` Shawn O. Pearce
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=7v1vyi5vq7.fsf_-_@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=pasky@suse.cz \
--cc=spearce@spearce.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.