projects
/
git.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
923d44a
)
gitweb: Fix bugs in git_search_grep_body: it's length(), not len()
author
Jakub Narebski
<jnareb@gmail.com>
Sat, 23 Feb 2008 21:37:08 +0000
(22:37 +0100)
committer
Junio C Hamano
<gitster@pobox.com>
Sat, 23 Feb 2008 22:22:01 +0000
(14:22 -0800)
Use int(<expr>/2) to get integer value for a substring length.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
gitweb/gitweb.perl
patch
|
blob
|
history
diff --git
a/gitweb/gitweb.perl
b/gitweb/gitweb.perl
index 326e27cf88b1158313df704e5fb5c4f8bbd50a01..e8226b16f4096673180b24d4362aa45ffe1e2e9a 100755
(executable)
--- a/
gitweb/gitweb.perl
+++ b/
gitweb/gitweb.perl
@@
-3792,7
+3792,7
@@
sub git_search_grep_body {
if ($line =~ m/^(.*)($search_regexp)(.*)$/i) {
my ($lead, $match, $trail) = ($1, $2, $3);
$match = chop_str($match, 70, 5); # in case match is very long
- my $contextlen =
(80 - len($match))/2; # is left
for the remainder
+ my $contextlen =
int((80 - length($match))/2); #
for the remainder
$contextlen = 30 if ($contextlen > 30); # but not too much
$lead = chop_str($lead, $contextlen, 10);
$trail = chop_str($trail, $contextlen, 10);