@matheusbsbs / matheus-bagliano / commits / 9074484a2b
Fork 0

Revert 954a6183756a073723a7c9fd8d2feb13132876b0

Luben makes a good argument against it, and I agree with him in general. The clickable handle that appear at seemingly random places makes them look as if they are separating groups when it is not. This also restores the executable bit I lost by mistake. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Oct 4, 2006 at 14:54 UTC 9074484a2ba28cd41a78e0b10074a8882653bf3a
1 file changed +13 -86
gitweb/gitweb.perl
+13 -86
@@ -2444,64 +2444,9 @@ sub git_tag {
2444 git_footer_html();
2445 }
2446
2447 -sub git_blame_flush_chunk {
2448 - my ($name, $revdata, $color, $rev, @line) = @_;
2449 - my $label = substr($rev, 0, 8);
2450 - my $line = scalar(@line);
2451 - my $cnt = 0;
2452 - my $pop = '';
2453 -
2454 - if ($revdata->{$rev} ne '') {
2455 - $pop = ' title="' . esc_html($revdata->{$rev}) . '"';
2456 - }
2457 -
2458 - for (@line) {
2459 - my ($lineno, $data) = @$_;
2460 - $cnt++;
2461 - print "<tr class=\"$color\">\n";
2462 - if ($cnt == 1) {
2463 - print "<td class=\"sha1\"$pop";
2464 - if ($line > 1) {
2465 - print " rowspan=\"$line\"";
2466 - }
2467 - print ">";
2468 - print $cgi->a({-href => href(action=>"commit",
2469 - hash=>$rev,
2470 - file_name=>$name)},
2471 - $label);
2472 - print "</td>\n";
2473 - }
2474 - print "<td class=\"linenr\">".
2475 - "<a id=\"l$lineno\" href=\"#l$lineno\" class=\"linenr\">" .
2476 - esc_html($lineno) . "</a></td>\n";
2477 - print "<td class=\"pre\">" . esc_html($data) . "</td>\n";
2478 - print "</tr>\n";
2479 - }
2480 -}
2481 -
2482 -# We can have up to N*2 lines. If it is more than N lines, split it
2483 -# into two to avoid orphans.
2484 -sub git_blame_flush_chunk_1 {
2485 - my ($chunk_cap, $name, $revdata, $color, $rev, @chunk) = @_;
2486 - if ($chunk_cap < @chunk) {
2487 - my @first = splice(@chunk, 0, @chunk/2);
2488 - git_blame_flush_chunk($name,
2489 - $revdata,
2490 - $color,
2491 - $rev,
2492 - @first);
2493 - }
2494 - git_blame_flush_chunk($name,
2495 - $revdata,
2496 - $color,
2497 - $rev,
2498 - @chunk);
2499 -}
2500 -
2447 sub git_blame2 {
2448 my $fd;
2449 my $ftype;
2504 - my $chunk_cap = 20;
2450
2451 my ($have_blame) = gitweb_check_feature('blame');
2452 if (!$have_blame) {
@@ -2544,45 +2489,27 @@ sub git_blame2 {
2489 <table class="blame">
2490 <tr><th>Commit</th><th>Line</th><th>Data</th></tr>
2491 HTML
2547 - my @chunk = ();
2548 - my %revdata = ();
2492 while (<$fd>) {
2493 /^([0-9a-fA-F]{40}).*?(\d+)\)\s{1}(\s*.*)/;
2551 - my ($full_rev, $author, $date, $lineno, $data) =
2552 - /^([0-9a-f]{40}).*?\s\((.*?)\s+([-\d]+ [:\d]+ [-+\d]+)\s+(\d+)\)\s(.*)/;
2553 - if (!exists $revdata{$full_rev}) {
2554 - $revdata{$full_rev} = "$author, $date";
2555 - }
2494 + my $full_rev = $1;
2495 + my $rev = substr($full_rev, 0, 8);
2496 + my $lineno = $2;
2497 + my $data = $3;
2498 +
2499 if (!defined $last_rev) {
2500 $last_rev = $full_rev;
2501 } elsif ($last_rev ne $full_rev) {
2559 - git_blame_flush_chunk_1($chunk_cap,
2560 - $file_name,
2561 - \%revdata,
2562 - $rev_color[$current_color],
2563 - $last_rev, @chunk);
2564 - @chunk = ();
2502 $last_rev = $full_rev;
2503 $current_color = ++$current_color % $num_colors;
2504 }
2568 - elsif ($chunk_cap * 2 < @chunk) {
2569 - # We have more than N*2 lines from the same
2570 - # revision. Flush N lines and leave N lines
2571 - # in @chunk to avoid orphaned lines.
2572 - my @first = splice(@chunk, 0, $chunk_cap);
2573 - git_blame_flush_chunk($file_name,
2574 - \%revdata,
2575 - $rev_color[$current_color],
2576 - $last_rev, @first);
2577 - }
2578 - push @chunk, [$lineno, $data];
2579 - }
2580 - if (@chunk) {
2581 - git_blame_flush_chunk_1($chunk_cap,
2582 - $file_name,
2583 - \%revdata,
2584 - $rev_color[$current_color],
2585 - $last_rev, @chunk);
2505 + print "<tr class=\"$rev_color[$current_color]\">\n";
2506 + print "<td class=\"sha1\">" .
2507 + $cgi->a({-href => href(action=>"commit", hash=>$full_rev, file_name=>$file_name)},
2508 + esc_html($rev)) . "</td>\n";
2509 + print "<td class=\"linenr\"><a id=\"l$lineno\" href=\"#l$lineno\" class=\"linenr\">" .
2510 + esc_html($lineno) . "</a></td>\n";
2511 + print "<td class=\"pre\">" . esc_html($data) . "</td>\n";
2512 + print "</tr>\n";
2513 }
2514 print "</table>\n";
2515 print "</div>";