Skip to content

Commit eee0184

Browse files
committed
Fix reading of cloud tags
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>
1 parent 67faaab commit eee0184

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

gitweb/gitweb.perl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1805,14 +1805,18 @@ sub git_get_project_ctags {
18051805
my $ctags = {};
18061806

18071807
$git_dir = "$projectroot/$path";
1808-
foreach (<$git_dir/ctags/*>) {
1808+
unless (opendir D, "$git_dir/ctags") {
1809+
return $ctags;
1810+
}
1811+
foreach (grep { -f $_ } map { "$git_dir/ctags/$_" } readdir(D)) {
18091812
open CT, $_ or next;
18101813
my $val = <CT>;
18111814
chomp $val;
18121815
close CT;
18131816
my $ctag = $_; $ctag =~ s#.*/##;
18141817
$ctags->{$ctag} = $val;
18151818
}
1819+
closedir D;
18161820
$ctags;
18171821
}
18181822

0 commit comments

Comments
 (0)