@matheusbsbs / matheus-bagliano / commits / 57017b3e15
Fork 0

gitweb: Simplify (and fix) chop_str

The chop_str subroutine is meant to be used on strings (such as commit description / title) *before* HTML escaping, which means before applying esc_html or equivalent. Therefore get rid of the failed attempt to always remove full HTML entities (like e.g. &amp; or &nbsp;). It is not necessary (HTML entities gets added later), and it can cause chop_str to chop a string incorrectly. Specifically: API & protocol: support option to force written data immediately to disk from http://git.kernel.org/?p=daemon/distsrv/chunkd.git;a=commit;h=3b02f749df2cb1288f345a689d85e7061f507e54 The short version of the title gets chopped to API ... where it should be API & protocol: support option to force written data... Noticed-by: John 'Warthog9' Hawley <warthog9@kernel.org> Signed-off-by: John 'Warthog9' Hawley <warthog9@kernel.org> Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

John 'Warthog9' Hawley committed Feb 3, 2010 at 12:28 UTC 57017b3e1554b169f3db52a7f8da4e359d043ca8
1 file changed -4
gitweb/gitweb.perl
-4
@@ -1330,7 +1330,6 @@ sub chop_str {
1330 $str =~ m/^(.*?)($begre)$/;
1331 my ($lead, $body) = ($1, $2);
1332 if (length($lead) > 4) {
1333 - $body =~ s/^[^;]*;// if ($lead =~ m/&[^;]*$/);
1333 $lead = " ...";
1334 }
1335 return "$lead$body";
@@ -1341,8 +1340,6 @@ sub chop_str {
1340 $str =~ m/^(.*?)($begre)$/;
1341 my ($mid, $right) = ($1, $2);
1342 if (length($mid) > 5) {
1344 - $left =~ s/&[^;]*$//;
1345 - $right =~ s/^[^;]*;// if ($mid =~ m/&[^;]*$/);
1343 $mid = " ... ";
1344 }
1345 return "$left$mid$right";
@@ -1352,7 +1349,6 @@ sub chop_str {
1349 my $body = $1;
1350 my $tail = $2;
1351 if (length($tail) > 4) {
1355 - $body =~ s/&[^;]*$//;
1352 $tail = "... ";
1353 }
1354 return "$body$tail";