Skip to content

Commit

Permalink
Fix reading of cloud tags
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Oct 15, 2008
1 parent 67faaab commit eee0184
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -1805,14 +1805,18 @@ sub git_get_project_ctags {
my $ctags = {};

$git_dir = "$projectroot/$path";
foreach (<$git_dir/ctags/*>) {
unless (opendir D, "$git_dir/ctags") {
return $ctags;
}
foreach (grep { -f $_ } map { "$git_dir/ctags/$_" } readdir(D)) {
open CT, $_ or next;
my $val = <CT>;
chomp $val;
close CT;
my $ctag = $_; $ctag =~ s#.*/##;
$ctags->{$ctag} = $val;
}
closedir D;
$ctags;
}

Expand Down

0 comments on commit eee0184

Please sign in to comment.