summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2cbd969)
raw | patch | inline | side by side (parent: 2cbd969)
author | Jonathan Nieder <jrnieder@gmail.com> | |
Thu, 9 Jun 2011 07:08:57 +0000 (02:08 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 9 Jun 2011 16:22:44 +0000 (09:22 -0700) |
v1.7.6-rc0~27^2~4 (gitweb: Change the way "content tags" ('ctags') are
handled, 2011-04-29) tried to make gitweb's tag cloud feature more
intuitive for webmasters by checking whether the ctags/<label> under
a project's .git dir contains a number (representing the strength of
association to <label>) before treating it as one.
With that change, after putting '$feature{'ctags'}{'default'} = [1];'
in your $GITWEB_CONFIG, you could do
echo Linux >.git/ctags/linux
and gitweb would treat that as a request to tag the current repository
with the Linux tag, instead of the previous behavior of writing an
error page embedded in the projects list that triggers error messages
from Chromium and Firefox about malformed XML.
Unfortunately the pattern (\d+) used to match numbers is too loose,
and the "XML declaration allowed only at the start of the document"
error can still be experienced if you write "Linux-2.6" in place of
"Linux" in the example above. Fix it by tightening the pattern to
^\d+$.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
handled, 2011-04-29) tried to make gitweb's tag cloud feature more
intuitive for webmasters by checking whether the ctags/<label> under
a project's .git dir contains a number (representing the strength of
association to <label>) before treating it as one.
With that change, after putting '$feature{'ctags'}{'default'} = [1];'
in your $GITWEB_CONFIG, you could do
echo Linux >.git/ctags/linux
and gitweb would treat that as a request to tag the current repository
with the Linux tag, instead of the previous behavior of writing an
error page embedded in the projects list that triggers error messages
from Chromium and Firefox about malformed XML.
Unfortunately the pattern (\d+) used to match numbers is too loose,
and the "XML declaration allowed only at the start of the document"
error can still be experienced if you write "Linux-2.6" in place of
"Linux" in the example above. Fix it by tightening the pattern to
^\d+$.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
gitweb/gitweb.perl | patch | blob | history | |
t/t9500-gitweb-standalone-no-errors.sh | patch | blob | history |
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index ebf2d1cf2c338e0f5e43f7220abcd8564294eb41..1b83a8d0a0adca8ffcc948bdca55d1f8e2bbaa48 100755 (executable)
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
close $ct;
(my $ctag = $tagfile) =~ s#.*/##;
- if ($val =~ /\d+/) {
+ if ($val =~ /^\d+$/) {
$ctags->{$ctag} = $val;
} else {
$ctags->{$ctag} = 1;
index f5648a669481e66f3cbbb87b769f0f939aad8fab..53297156a314a5b5e03385a3ad887eff959359c4 100755 (executable)
'ctags: search projects by non existent tag' \
'gitweb_run "by_tag=non-existent"'
+test_expect_success \
+ 'ctags: malformed tag weights' \
+ 'mkdir -p .git/ctags &&
+ echo "not-a-number" > .git/ctags/nan &&
+ echo "not-a-number-2" > .git/ctags/nan2 &&
+ echo "0.1" >.git/ctags/floating-point &&
+ gitweb_run'
+
# ----------------------------------------------------------------------
# categories