@matheusbsbs / matheus-bagliano / commits / a8b983bfea
Fork 0

gitweb: Change history action to use parse_commits.

Also added missing accesskey. Signed-off-by: Robert Fitzsimons <robfitz@273k.net> Signed-off-by: Junio C Hamano <junkio@cox.net>

Robert Fitzsimons committed Dec 24, 2006 at 14:31 UTC a8b983bfea9daa255fd32dfc6b39e809733e4c5a
1 file changed +9 -18
gitweb/gitweb.perl
+9 -18
@@ -2750,23 +2750,19 @@ sub git_shortlog_body {
2750
2751 sub git_history_body {
2752 # Warning: assumes constant type (blob or tree) during history
2753 - my ($revlist, $from, $to, $refs, $hash_base, $ftype, $extra) = @_;
2753 + my ($commitlist, $from, $to, $refs, $hash_base, $ftype, $extra) = @_;
2754
2755 $from = 0 unless defined $from;
2756 - $to = $#{$revlist} unless (defined $to && $to <= $#{$revlist});
2756 + $to = $#{$commitlist} unless (defined $to && $to <= $#{$commitlist});
2757
2758 print "<table class=\"history\" cellspacing=\"0\">\n";
2759 my $alternate = 1;
2760 for (my $i = $from; $i <= $to; $i++) {
2761 - if ($revlist->[$i] !~ m/^([0-9a-fA-F]{40})/) {
2762 - next;
2763 - }
2764 -
2765 - my $commit = $1;
2766 - my %co = parse_commit($commit);
2761 + my %co = %{$commitlist->[$i]};
2762 if (!%co) {
2763 next;
2764 }
2765 + my $commit = $co{'id'};
2766
2767 my $ref = format_ref_marker($refs, $commit);
2768
@@ -4219,12 +4215,7 @@ sub git_history {
4215 $ftype = git_get_type($hash);
4216 }
4217
4222 - open my $fd, "-|",
4223 - git_cmd(), "rev-list", $limit, "--full-history", $hash_base, "--", $file_name
4224 - or die_error(undef, "Open git-rev-list-failed");
4225 - my @revlist = map { chomp; $_ } <$fd>;
4226 - close $fd
4227 - or die_error(undef, "Reading git-rev-list failed");
4218 + my @commitlist = parse_commits($hash_base, 101, (100 * $page), "--full-history", $file_name);
4219
4220 my $paging_nav = '';
4221 if ($page > 0) {
@@ -4240,7 +4231,7 @@ sub git_history {
4231 $paging_nav .= "first";
4232 $paging_nav .= " &sdot; prev";
4233 }
4243 - if ($#revlist >= (100 * ($page+1)-1)) {
4234 + if ($#commitlist >= 100) {
4235 $paging_nav .= " &sdot; " .
4236 $cgi->a({-href => href(action=>"history", hash=>$hash, hash_base=>$hash_base,
4237 file_name=>$file_name, page=>$page+1),
@@ -4249,11 +4240,11 @@ sub git_history {
4240 $paging_nav .= " &sdot; next";
4241 }
4242 my $next_link = '';
4252 - if ($#revlist >= (100 * ($page+1)-1)) {
4243 + if ($#commitlist >= 100) {
4244 $next_link =
4245 $cgi->a({-href => href(action=>"history", hash=>$hash, hash_base=>$hash_base,
4246 file_name=>$file_name, page=>$page+1),
4256 - -title => "Alt-n"}, "next");
4247 + -accesskey => "n", -title => "Alt-n"}, "next");
4248 }
4249
4250 git_header_html();
@@ -4261,7 +4252,7 @@ sub git_history {
4252 git_print_header_div('commit', esc_html($co{'title'}), $hash_base);
4253 git_print_page_path($file_name, $ftype, $hash_base);
4254
4264 - git_history_body(\@revlist, ($page * 100), $#revlist,
4255 + git_history_body(\@commitlist, 0, 99,
4256 $refs, $hash_base, $ftype, $next_link);
4257
4258 git_footer_html();