3 # gitweb - simple web interface to track changes in git repositories
5 # (C) 2005, Kay Sievers <kay.sievers@vrfy.org>
6 # (C) 2005, Christian Gierke <ch@gierke.de>
8 # This program is licensed under the GPL v2, or a later version
12 use CGI qw(:standard :escapeHTML -nosticky);
13 use CGI::Util qw(unescape);
14 use CGI::Carp qw(fatalsToBrowser);
19 my $my_url = $cgi->url();
20 my $my_uri = $cgi->url(-absolute => 1);
23 # absolute fs-path which will be prepended to the project path
24 my $projectroot = "/pub/scm";
26 # location of the git-core binaries
27 my $gitbin = "/usr/bin";
29 # location for temporary files needed for diffs
30 my $git_temp = "/tmp/gitweb";
32 # target of the home link on top of all pages
33 my $home_link = $my_uri;
35 # html text to include at home page
36 my $home_text = "indextext.html";
38 # source of projects list
39 #my $projects_list = $projectroot;
40 my $projects_list = "index/index.aux";
42 # input validation and dispatch
43 my $action = $cgi->param('a');
44 if (defined $action) {
45 if ($action =~ m/[^0-9a-zA-Z\.\-_]+/) {
47 die_error(undef, "Invalid action parameter.");
49 if ($action eq "git-logo.png") {
52 } elsif ($action eq "opml") {
58 my $project = $cgi->param('p');
59 if (defined $project) {
60 if ($project =~ m/(^|\/)(|\.|\.\.)($|\/)/) {
62 die_error(undef, "Non-canonical project parameter.");
64 if ($project =~ m/[^a-zA-Z0-9_\.\/\-\+\#\~]/) {
66 die_error(undef, "Invalid character in project parameter.");
68 if (!(-d "$projectroot/$project")) {
70 die_error(undef, "No such directory.");
72 if (!(-e "$projectroot/$project/HEAD")) {
74 die_error(undef, "No such project.");
76 $rss_link = "<link rel=\"alternate\" title=\"$project log\" href=\"$my_uri?p=$project;a=rss\" type=\"application/rss+xml\"/>";
77 $ENV{'GIT_DIR'} = "$projectroot/$project";
83 my $file_name = $cgi->param('f');
84 if (defined $file_name) {
85 if ($file_name =~ m/(^|\/)(|\.|\.\.)($|\/)/) {
87 die_error(undef, "Non-canonical file parameter.");
89 if ($file_name =~ m/[^a-zA-Z0-9_\.\/\-\+\#\~\:\!]/) {
91 die_error(undef, "Invalid character in file parameter.");
95 my $hash = $cgi->param('h');
97 if (!($hash =~ m/^[0-9a-fA-F]{40}$/)) {
98 if ($hash =~ m/(^|\/)(|\.|\.\.)($|\/)/) {
100 die_error(undef, "Non-canonical hash parameter.");
102 if ($hash =~ m/[^a-zA-Z0-9_\.\/\-\+\#\~\:\!]/) {
104 die_error(undef, "Invalid character in hash parameter.");
106 # replace branch-name with hash
107 my $branchlist = git_read_refs("refs/heads");
108 foreach my $entry (@$branchlist) {
109 my %branch = %$entry;
110 if ($branch{'name'} eq $hash) {
111 $hash = $branch{'id'};
118 my $hash_parent = $cgi->param('hp');
119 if (defined $hash_parent && !($hash_parent =~ m/^[0-9a-fA-F]{40}$/)) {
121 die_error(undef, "Invalid hash_parent parameter.");
124 my $hash_base = $cgi->param('hb');
125 if (defined $hash_base && !($hash_base =~ m/^[0-9a-fA-F]{40}$/)) {
127 die_error(undef, "Invalid parent hash parameter.");
130 my $page = $cgi->param('pg');
132 if ($page =~ m/^[^0-9]+$/) {
134 die_error(undef, "Invalid page parameter.");
138 my $searchtext = $cgi->param('s');
139 if (defined $searchtext) {
140 if ($searchtext =~ m/[^a-zA-Z0-9_\.\/\-\+\:\@ ]/) {
142 die_error(undef, "Invalid search parameter.");
144 $searchtext = quotemeta $searchtext;
147 if (!defined $action || $action eq "summary") {
150 } elsif ($action eq "branches") {
153 } elsif ($action eq "tags") {
156 } elsif ($action eq "blob") {
159 } elsif ($action eq "blob_plain") {
162 } elsif ($action eq "tree") {
165 } elsif ($action eq "rss") {
168 } elsif ($action eq "commit") {
171 } elsif ($action eq "log") {
174 } elsif ($action eq "blobdiff") {
177 } elsif ($action eq "blobdiff_plain") {
178 git_blobdiff_plain();
180 } elsif ($action eq "commitdiff") {
183 } elsif ($action eq "commitdiff_plain") {
184 git_commitdiff_plain();
186 } elsif ($action eq "history") {
189 } elsif ($action eq "search") {
192 } elsif ($action eq "shortlog") {
197 die_error(undef, "Unknown action.");
201 sub git_header_html {
202 my $status = shift || "200 OK";
205 if (defined $project) {
206 $title .= " - $project";
207 if (defined $action) {
208 $title .= "/$action";
211 print $cgi->header(-type=>'text/html', -charset => 'utf-8', -status=> $status);
213 <?xml version="1.0" encoding="utf-8"?>
214 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
215 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
216 <!-- git web interface v$version, (C) 2005, Kay Sievers <kay.sievers\@vrfy.org>, Christian Gierke <ch\@gierke.de> -->
218 <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
219 <meta name="robots" content="index, nofollow"/>
220 <title>$title</title>
222 <style type="text/css">
223 body { font-family: sans-serif; font-size: 12px; margin:0px; border:solid #d9d8d1; border-width:1px; margin:10px; }
225 a:hover, a:visited, a:active { color:#880000; }
226 div.page_header { height:25px; padding:8px; font-size:18px; font-weight:bold; background-color:#d9d8d1; }
227 div.page_header a:visited { color:#0000cc; }
228 div.page_header a:hover { color:#880000; }
229 div.page_nav { padding:8px; }
230 div.page_nav a:visited { color:#0000cc; }
231 div.page_path { padding:8px; border:solid #d9d8d1; border-width:0px 0px 1px}
232 div.page_footer { height:17px; padding:4px 8px; background-color: #d9d8d1; }
233 div.page_footer_text { float:left; color:#555555; font-style:italic; }
234 div.page_body { padding:8px; }
236 display:block; padding:6px 8px;
237 font-weight:bold; background-color:#edece6; text-decoration:none; color:#000000;
239 a.title:hover { background-color: #d9d8d1; }
240 div.title_text { padding:6px 0px; border: solid #d9d8d1; border-width:0px 0px 1px; }
241 div.log_body { padding:8px 8px 8px 150px; }
242 span.age { position:relative; float:left; width:142px; font-style:italic; }
245 font-size:10px; font-family:sans-serif; font-style:normal;
246 position:relative; float:left; width:136px;
248 div.list_head { padding:6px 8px 4px; border:solid #d9d8d1; border-width:1px 0px 0px; font-style:italic; }
249 a.list { text-decoration:none; color:#000000; }
250 a.list:hover { text-decoration:underline; color:#880000; }
251 table { padding:8px 4px; }
252 th { padding:2px 5px; font-size:12px; text-align:left; }
253 tr.light:hover { background-color:#edece6; }
254 tr.dark { background-color:#f6f6f0; }
255 tr.dark:hover { background-color:#edece6; }
256 td { padding:2px 5px; font-size:12px; vertical-align:top; }
257 td.link { padding:2px 5px; font-family:sans-serif; font-size:10px; }
258 div.pre { font-family:monospace; font-size:12px; white-space:pre; }
259 div.diff_info { font-family:monospace; color:#000099; background-color:#edece6; font-style:italic; }
260 div.index_include { border:solid #d9d8d1; border-width:0px 0px 1px; padding:12px 8px; }
261 div.search { margin:4px 8px; position:absolute; top:56px; right:12px }
262 a.linenr { color:#999999; text-decoration:none }
264 float:right; padding:3px 0px; width:35px; line-height:10px;
265 border:1px solid; border-color:#fcc7a5 #7d3302 #3e1a01 #ff954e;
266 color:#ffffff; background-color:#ff6600;
267 font-weight:bold; font-family:sans-serif; font-size:10px;
268 text-align:center; text-decoration:none;
270 a.rss_logo:hover { background-color:#ee5500; }
275 print "<div class=\"page_header\">\n" .
276 "<a href=\"http://www.kernel.org/pub/software/scm/git/docs/\" title=\"git documentation\">" .
277 "<img src=\"$my_uri?a=git-logo.png\" width=\"72\" height=\"27\" alt=\"git\" style=\"float:right; border-width:0px;\"/>" .
279 print $cgi->a({-href => $home_link}, "projects") . " / ";
280 if (defined $project) {
281 print $cgi->a({-href => "$my_uri?p=$project;a=summary"}, escapeHTML($project));
282 if (defined $action) {
286 if (!defined $searchtext) {
289 $cgi->param("a", "search");
290 print $cgi->startform(-method => "get", -action => "$my_uri") .
291 "<div class=\"search\">\n" .
292 $cgi->hidden(-name => "p") . "\n" .
293 $cgi->hidden(-name => "a") . "\n" .
294 $cgi->textfield(-name => "s", -value => $searchtext) . "\n" .
296 $cgi->end_form() . "\n";
301 sub git_footer_html {
302 print "<div class=\"page_footer\">\n";
303 if (defined $project) {
304 my $descr = git_read_description($project);
305 if (defined $descr) {
306 print "<div class=\"page_footer_text\">" . escapeHTML($descr) . "</div>\n";
308 print $cgi->a({-href => "$my_uri?p=$project;a=rss", -class => "rss_logo"}, "RSS") . "\n";
310 print $cgi->a({-href => "$my_uri?a=opml", -class => "rss_logo"}, "RSS") . "\n";
318 my $status = shift || "403 Forbidden";
319 my $error = shift || "Malformed query, file missing or permission denied";
321 git_header_html($status);
322 print "<div class=\"page_body\">\n" .
324 "$status - $error\n" .
334 open my $fd, "-|", "$gitbin/git-cat-file -t $hash" or return;
344 open my $fd, "$projectroot/$path" or return undef;
348 if ($head =~ m/^[0-9a-fA-F]{40}$/) {
353 sub git_read_description {
356 open my $fd, "$projectroot/$path/description" or return undef;
367 open my $fd, "-|", "$gitbin/git-cat-file tag $tag_id" or return;
368 while (my $line = <$fd>) {
370 if ($line =~ m/^object ([0-9a-fA-F]{40})$/) {
372 } elsif ($line =~ m/^type (.+)$/) {
374 } elsif ($line =~ m/^tag (.+)$/) {
379 if (!defined $tag{'name'}) {
385 sub git_read_commit {
386 my $commit_id = shift;
387 my $commit_text = shift;
393 if (defined $commit_text) {
394 @commit_lines = @$commit_text;
396 open my $fd, "-|", "$gitbin/git-cat-file commit $commit_id" or return;
397 @commit_lines = map { chomp; $_ } <$fd>;
400 while (my $line = shift @commit_lines) {
401 last if $line eq "\n";
402 if ($line =~ m/^tree ([0-9a-fA-F]{40})$/) {
404 } elsif ($line =~ m/^parent ([0-9a-fA-F]{40})$/) {
406 } elsif ($line =~ m/^author (.*) ([0-9]+) (.*)$/) {
408 $co{'author_epoch'} = $2;
409 $co{'author_tz'} = $3;
410 if ($co{'author'} =~ m/^([^<]+) </) {
411 $co{'author_name'} = $1;
413 $co{'author_name'} = $co{'author'};
415 } elsif ($line =~ m/^committer (.*) ([0-9]+) (.*)$/) {
416 $co{'committer'} = $1;
417 $co{'committer_epoch'} = $2;
418 $co{'committer_tz'} = $3;
419 $co{'committer_name'} = $co{'committer'};
420 $co{'committer_name'} =~ s/ <.*//;
423 if (!defined $co{'tree'}) {
426 $co{'id'} = $commit_id;
427 $co{'parents'} = \@parents;
428 $co{'parent'} = $parents[0];
429 $co{'comment'} = \@commit_lines;
430 foreach my $title (@commit_lines) {
432 $co{'title'} = chop_str($title, 80);
433 # remove leading stuff of merges to make the interesting part visible
434 if (length($title) > 50) {
435 $title =~ s/^Automatic //;
436 $title =~ s/^merge (of|with) /Merge ... /i;
437 if (length($title) > 50) {
438 $title =~ s/(http|rsync):\/\///;
440 if (length($title) > 50) {
441 $title =~ s/(master|www|rsync)\.//;
443 if (length($title) > 50) {
444 $title =~ s/kernel.org:?//;
446 if (length($title) > 50) {
447 $title =~ s/\/pub\/scm//;
450 $co{'title_short'} = chop_str($title, 50);
455 my $age = time - $co{'committer_epoch'};
457 if ($age > 60*60*24*365*2) {
458 $co{'age_string'} = (int $age/60/60/24/365);
459 $co{'age_string'} .= " years ago";
460 } elsif ($age > 60*60*24*(365/12)*2) {
461 $co{'age_string'} = int $age/60/60/24/(365/12);
462 $co{'age_string'} .= " months ago";
463 } elsif ($age > 60*60*24*7*2) {
464 $co{'age_string'} = int $age/60/60/24/7;
465 $co{'age_string'} .= " weeks ago";
466 } elsif ($age > 60*60*24*2) {
467 $co{'age_string'} = int $age/60/60/24;
468 $co{'age_string'} .= " days ago";
469 } elsif ($age > 60*60*2) {
470 $co{'age_string'} = int $age/60/60;
471 $co{'age_string'} .= " hours ago";
472 } elsif ($age > 60*2) {
473 $co{'age_string'} = int $age/60;
474 $co{'age_string'} .= " min ago";
476 $co{'age_string'} = int $age;
477 $co{'age_string'} .= " sec ago";
479 $co{'age_string'} .= " right now";
481 my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = gmtime($co{'committer_epoch'});
482 if ($age > 60*60*24*7*2) {
483 $co{'age_string_date'} = sprintf "%4i-%02u-%02i", 1900 + $year, $mon+1, $mday;
484 $co{'age_string_age'} = $co{'age_string'};
486 $co{'age_string_date'} = $co{'age_string'};
487 $co{'age_string_age'} = sprintf "%4i-%02u-%02i", 1900 + $year, $mon+1, $mday;
494 my $from_name = shift;
497 my $format = shift || "html";
499 my $from_tmp = "/dev/null";
500 my $to_tmp = "/dev/null";
503 # create tmp from-file
505 $from_tmp = "$git_temp/gitweb_" . $$ . "_from";
506 open my $fd2, "> $from_tmp";
507 open my $fd, "-|", "$gitbin/git-cat-file blob $from";
516 $to_tmp = "$git_temp/gitweb_" . $$ . "_to";
517 open my $fd2, "> $to_tmp";
518 open my $fd, "-|", "$gitbin/git-cat-file blob $to";
525 open my $fd, "-|", "/usr/bin/diff -u -p -L $from_name -L $to_name $from_tmp $to_tmp";
526 if ($format eq "plain") {
531 while (my $line = <$fd>) {
533 my $char = substr($line, 0, 1);
536 $color = " style=\"color:#008800;\"";
537 } elsif ($char eq "-") {
538 $color = " style=\"color:#cc0000;\"";
539 } elsif ($char eq "@") {
540 $color = " style=\"color:#990099;\"";
541 } elsif ($char eq "\\") {
545 while ((my $pos = index($line, "\t")) != -1) {
546 if (my $count = (8 - (($pos-1) % 8))) {
547 my $spaces = ' ' x $count;
548 $line =~ s/\t/$spaces/;
551 print "<div class=\"pre\"$color>" . escapeHTML($line) . "</div>\n";
565 my $mode = oct shift;
567 if (S_ISDIR($mode & S_IFMT)) {
569 } elsif (S_ISLNK($mode)) {
571 } elsif (S_ISREG($mode)) {
572 # git cares only about the executable bit
573 if ($mode & S_IXUSR) {
586 my $add_len = shift || 10;
588 $str =~ m/^(.{0,$len}[^ \/\-_:\.@]{0,$add_len})/;
590 if ($chopped ne $str) {
597 my $mode = oct shift;
599 if (S_ISDIR($mode & S_IFMT)) {
601 } elsif (S_ISLNK($mode)) {
603 } elsif (S_ISREG($mode)) {
612 my $tz = shift || "-0000";
615 my @months = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
616 my @days = ("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
617 my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = gmtime($epoch);
618 $date{'hour'} = $hour;
619 $date{'minute'} = $min;
620 $date{'mday'} = $mday;
621 $date{'day'} = $days[$wday];
622 $date{'month'} = $months[$mon];
623 $date{'rfc2822'} = sprintf "%s, %d %s %4d %02d:%02d:%02d +0000", $days[$wday], $mday, $months[$mon], 1900+$year, $hour ,$min, $sec;
624 $date{'mday-time'} = sprintf "%d %s %02d:%02d", $mday, $months[$mon], $hour ,$min;
626 $tz =~ m/^([+\-][0-9][0-9])([0-9][0-9])$/;
627 my $local = $epoch + ((int $1 + ($2/60)) * 3600);
628 ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = gmtime($local);
629 $date{'hour_local'} = $hour;
630 $date{'minute_local'} = $min;
631 $date{'tz_local'} = $tz;
635 # git-logo (cached in browser for one day)
637 print $cgi->header(-type => 'image/png', -expires => '+1d');
638 # cat git-logo.png | hexdump -e '16/1 " %02x" "\n"' | sed 's/ /\\x/g'
639 print "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52" .
640 "\x00\x00\x00\x48\x00\x00\x00\x1b\x04\x03\x00\x00\x00\x2d\xd9\xd4" .
641 "\x2d\x00\x00\x00\x18\x50\x4c\x54\x45\xff\xff\xff\x60\x60\x5d\xb0" .
642 "\xaf\xaa\x00\x80\x00\xce\xcd\xc7\xc0\x00\x00\xe8\xe8\xe6\xf7\xf7" .
643 "\xf6\x95\x0c\xa7\x47\x00\x00\x00\x73\x49\x44\x41\x54\x28\xcf\x63" .
644 "\x48\x67\x20\x04\x4a\x5c\x18\x0a\x08\x2a\x62\x53\x61\x20\x02\x08" .
645 "\x0d\x69\x45\xac\xa1\xa1\x01\x30\x0c\x93\x60\x36\x26\x52\x91\xb1" .
646 "\x01\x11\xd6\xe1\x55\x64\x6c\x6c\xcc\x6c\x6c\x0c\xa2\x0c\x70\x2a" .
647 "\x62\x06\x2a\xc1\x62\x1d\xb3\x01\x02\x53\xa4\x08\xe8\x00\x03\x18" .
648 "\x26\x56\x11\xd4\xe1\x20\x97\x1b\xe0\xb4\x0e\x35\x24\x71\x29\x82" .
649 "\x99\x30\xb8\x93\x0a\x11\xb9\x45\x88\xc1\x8d\xa0\xa2\x44\x21\x06" .
650 "\x27\x41\x82\x40\x85\xc1\x45\x89\x20\x70\x01\x00\xa4\x3d\x21\xc5" .
651 "\x12\x1c\x9a\xfe\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82";
657 my ($dev, $ino, $mode, $nlink, $st_uid, $st_gid, $rdev, $size) = stat($path);
658 my ($name, $passwd, $uid, $gid, $quota, $comment, $gcos, $dir, $shell) = getpwuid($st_uid);
659 if (!defined $gcos) {
663 $owner =~ s/[,;].*$//;
667 sub git_read_projects {
670 if (-d $projects_list) {
671 # search in directory
672 my $dir = $projects_list;
673 opendir my $dh, $dir or return undef;
674 while (my $dir = readdir($dh)) {
675 if (-e "$projectroot/$dir/HEAD") {
683 } elsif (-f $projects_list) {
684 # read from file(url-encoded):
685 # 'git%2Fgit.git Linus+Torvalds'
686 # 'libs%2Fklibc%2Fklibc.git H.+Peter+Anvin'
687 # 'linux%2Fhotplug%2Fudev.git Greg+Kroah-Hartman'
688 open my $fd , $projects_list or return undef;
689 while (my $line = <$fd>) {
691 my ($path, $owner) = split ' ', $line;
692 $path = unescape($path);
693 $owner = unescape($owner);
694 if (!defined $path) {
697 if (-e "$projectroot/$path/HEAD") {
707 @list = sort {$a->{'path'} cmp $b->{'path'}} @list;
711 sub git_project_list {
712 my @list = git_read_projects();
714 die_error(undef, "No project found.");
718 print "<div class=\"index_include\">\n";
719 open (my $fd, $home_text);
724 print "<table cellspacing=\"0\">\n" .
726 "<th>Project</th>\n" .
727 "<th>Description</th>\n" .
729 "<th>last change</th>\n" .
733 foreach my $pr (@list) {
735 my $head = git_read_hash("$proj{'path'}/HEAD");
736 if (!defined $head) {
739 $ENV{'GIT_DIR'} = "$projectroot/$proj{'path'}";
740 my %co = git_read_commit($head);
744 my $descr = git_read_description($proj{'path'}) || "";
745 $descr = chop_str($descr, 25, 5);
746 # get directory owner if not already specified
747 if (!defined $proj{'owner'}) {
748 $proj{'owner'} = get_file_owner("$projectroot/$proj{'path'}") || "";
751 print "<tr class=\"dark\">\n";
753 print "<tr class=\"light\">\n";
756 print "<td>" . $cgi->a({-href => "$my_uri?p=$proj{'path'};a=summary", -class => "list"}, escapeHTML($proj{'path'})) . "</td>\n" .
757 "<td>$descr</td>\n" .
758 "<td><i>" . chop_str($proj{'owner'}, 15) . "</i></td>\n";
760 if ($co{'age'} < 60*60*2) {
761 $colored_age = "<span style =\"color: #009900;\"><b><i>$co{'age_string'}</i></b></span>";
762 } elsif ($co{'age'} < 60*60*24*2) {
763 $colored_age = "<span style =\"color: #009900;\"><i>$co{'age_string'}</i></span>";
765 $colored_age = "<i>$co{'age_string'}</i>";
767 print "<td>$colored_age</td>\n" .
768 "<td class=\"link\">" .
769 $cgi->a({-href => "$my_uri?p=$proj{'path'};a=summary"}, "summary") .
770 " | " . $cgi->a({-href => "$my_uri?p=$proj{'path'};a=shortlog"}, "shortlog") .
771 " | " . $cgi->a({-href => "$my_uri?p=$proj{'path'};a=log"}, "log") .
784 opendir my $dh, "$projectroot/$project/$ref_dir";
785 while (my $dir = readdir($dh)) {
786 if ($dir =~ m/^\./) {
789 if (-d "$projectroot/$project/$ref_dir/$dir") {
790 opendir my $dh2, "$projectroot/$project/$ref_dir/$dir";
791 my @subdirs = grep !m/^\./, readdir $dh2;
793 foreach my $subdir (@subdirs) {
794 push @refs, "$dir/$subdir"
801 foreach my $ref_file (@refs) {
802 my $ref_id = git_read_hash("$project/$ref_dir/$ref_file");
803 my $type = git_get_type($ref_id) || next;
806 if ($type eq "tag") {
807 my %tag = git_read_tag($ref_id);
808 if ($tag{'type'} eq "commit") {
809 %co = git_read_commit($tag{'object'});
811 $ref_item{'type'} = $tag{'type'};
812 $ref_item{'name'} = $tag{'name'};
813 $ref_item{'id'} = $tag{'object'};
814 } elsif ($type eq "commit"){
815 %co = git_read_commit($ref_id);
816 $ref_item{'type'} = "commit";
817 $ref_item{'name'} = $ref_file;
818 $ref_item{'title'} = $co{'title'};
819 $ref_item{'id'} = $ref_id;
821 $ref_item{'epoch'} = $co{'committer_epoch'} || 0;
822 $ref_item{'age'} = $co{'age_string'} || "unknown";
824 push @reflist, \%ref_item;
827 @reflist = sort {$b->{'epoch'} <=> $a->{'epoch'}} @reflist;
832 my $descr = git_read_description($project) || "none";
833 my $head = git_read_hash("$project/HEAD");
834 my %co = git_read_commit($head);
835 my %cd = date_str($co{'committer_epoch'}, $co{'committer_tz'});
838 if (-f $projects_list) {
839 open (my $fd , $projects_list);
840 while (my $line = <$fd>) {
842 my ($pr, $ow) = split ' ', $line;
845 if ($pr eq $project) {
852 if (!defined $owner) {
853 $owner = get_file_owner("$projectroot/$project");
857 print "<div class=\"page_nav\">\n" .
859 " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog"}, "shortlog") .
860 " | " . $cgi->a({-href => "$my_uri?p=$project;a=log"}, "log") .
861 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$head"}, "commit") .
862 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$head"}, "commitdiff") .
863 " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree"}, "tree") .
866 print "<div class=\"title\"> </div>\n";
867 print "<table cellspacing=\"0\">\n" .
868 "<tr><td>description</td><td>" . escapeHTML($descr) . "</td></tr>\n" .
869 "<tr><td>owner</td><td>$owner</td></tr>\n" .
870 "<tr><td>last change</td><td>$cd{'rfc2822'}</td></tr>\n" .
872 open my $fd, "-|", "$gitbin/git-rev-list --max-count=17 " . git_read_hash("$project/HEAD") or die_error(undef, "Open failed.");
873 my (@revlist) = map { chomp; $_ } <$fd>;
876 $cgi->a({-href => "$my_uri?p=$project;a=shortlog", -class => "title"}, "shortlog") .
879 print "<table cellspacing=\"0\">\n";
881 foreach my $commit (@revlist) {
882 my %co = git_read_commit($commit);
883 my %ad = date_str($co{'author_epoch'});
885 print "<tr class=\"dark\">\n";
887 print "<tr class=\"light\">\n";
891 print "<td><i>$co{'age_string'}</i></td>\n" .
892 "<td><i>" . escapeHTML(chop_str($co{'author_name'}, 10)) . "</i></td>\n" .
894 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit", -class => "list"},
895 "<b>" . escapeHTML($co{'title_short'}) . "</b>") .
897 "<td class=\"link\">" .
898 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"}, "commit") .
899 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$commit"}, "commitdiff") .
903 print "<td>" . $cgi->a({-href => "$my_uri?p=$project;a=shortlog"}, "...") . "</td>\n" .
910 my $taglist = git_read_refs("refs/tags");
911 if (defined @$taglist) {
913 $cgi->a({-href => "$my_uri?p=$project;a=tags", -class => "title"}, "tags") .
916 print "<table cellspacing=\"0\">\n";
918 foreach my $entry (@$taglist) {
921 print "<tr class=\"dark\">\n";
923 print "<tr class=\"light\">\n";
927 print "<td><i>$tag{'age'}</i></td>\n" .
929 $cgi->a({-href => "$my_uri?p=$project;a=$tag{'type'};h=$tag{'id'}", -class => "list"}, "<b>" .
930 escapeHTML($tag{'name'}) . "</b>") .
932 "<td class=\"link\">" .
933 $cgi->a({-href => "$my_uri?p=$project;a=$tag{'type'};h=$tag{'id'}"}, $tag{'type'});
934 if ($tag{'type'} eq "commit") {
935 print " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'id'}"}, "shortlog") .
936 " | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'id'}"}, "log");
941 print "<td>" . $cgi->a({-href => "$my_uri?p=$project;a=tags"}, "...") . "</td>\n" .
949 my $branchlist = git_read_refs("refs/heads");
950 if (defined @$branchlist) {
952 $cgi->a({-href => "$my_uri?p=$project;a=branches", -class => "title"}, "branches") .
955 print "<table cellspacing=\"0\">\n";
957 foreach my $entry (@$branchlist) {
960 print "<tr class=\"dark\">\n";
962 print "<tr class=\"light\">\n";
966 print "<td><i>$tag{'age'}</i></td>\n" .
968 $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'name'}", -class => "list"},
969 "<b>" . escapeHTML($tag{'name'}) . "</b>") .
971 "<td class=\"link\">" .
972 $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'name'}"}, "shortlog") .
973 " | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'name'}"}, "log") .
977 print "<td>" . $cgi->a({-href => "$my_uri?p=$project;a=branches"}, "...") . "</td>\n" .
988 my $head = git_read_hash("$project/HEAD");
990 print "<div class=\"page_nav\">\n" .
991 $cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") .
992 " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog"}, "shortlog") .
993 " | " . $cgi->a({-href => "$my_uri?p=$project;a=log"}, "log") .
994 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$head"}, "commit") .
995 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$head"}, "commitdiff") .
996 " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;hb=$head"}, "tree") . "<br/>\n" .
999 my $taglist = git_read_refs("refs/tags");
1001 $cgi->a({-href => "$my_uri?p=$project;a=summary", -class => "title"}, " ") .
1003 print "<table cellspacing=\"0\">\n";
1005 if (defined @$taglist) {
1006 foreach my $entry (@$taglist) {
1009 print "<tr class=\"dark\">\n";
1011 print "<tr class=\"light\">\n";
1014 print "<td><i>$tag{'age'}</i></td>\n" .
1016 $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'id'}", -class => "list"},
1017 "<b>" . escapeHTML($tag{'name'}) . "</b>") .
1019 "<td class=\"link\">" .
1020 $cgi->a({-href => "$my_uri?p=$project;a=$tag{'type'};h=$tag{'id'}"}, $tag{'type'});
1021 if ($tag{'type'} eq "commit") {
1022 print " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'name'}"}, "shortlog") .
1023 " | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'id'}"}, "log");
1034 my $head = git_read_hash("$project/HEAD");
1036 print "<div class=\"page_nav\">\n" .
1037 $cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") .
1038 " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog"}, "shortlog") .
1039 " | " . $cgi->a({-href => "$my_uri?p=$project;a=log"}, "log") .
1040 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$head"}, "commit") .
1041 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$head"}, "commitdiff") .
1042 " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;hb=$head"}, "tree") . "<br/>\n" .
1045 my $taglist = git_read_refs("refs/heads");
1047 $cgi->a({-href => "$my_uri?p=$project;a=summary", -class => "title"}, " ") .
1049 print "<table cellspacing=\"0\">\n";
1051 if (defined @$taglist) {
1052 foreach my $entry (@$taglist) {
1055 print "<tr class=\"dark\">\n";
1057 print "<tr class=\"light\">\n";
1060 print "<td><i>$tag{'age'}</i></td>\n" .
1062 $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'name'}", -class => "list"}, "<b>" . escapeHTML($tag{'name'}) . "</b>") .
1064 "<td class=\"link\">" .
1065 $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'name'}"}, "shortlog") .
1066 " | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'name'}"}, "log") .
1075 sub git_get_hash_by_path {
1077 my $path = shift || return undef;
1080 my @parts = split '/', $path;
1081 while (my $part = shift @parts) {
1082 open my $fd, "-|", "$gitbin/git-ls-tree $tree" or die_error(undef, "Open git-ls-tree failed.");
1083 my (@entries) = map { chomp; $_ } <$fd>;
1084 close $fd or return undef;
1085 foreach my $line (@entries) {
1086 #'100644 blob 0fa3f3a66fb6a137f6ec2c19351ed4d807070ffa panic.c'
1087 $line =~ m/^([0-9]+) (.+) ([0-9a-fA-F]{40})\t(.+)$/;
1092 if ($t_name eq $part) {
1096 if ($t_type eq "tree") {
1106 if (!defined $hash && defined $file_name) {
1107 my $base = $hash_base || git_read_hash("$project/HEAD");
1108 $hash = git_get_hash_by_path($base, $file_name, "blob");
1110 open my $fd, "-|", "$gitbin/git-cat-file blob $hash" or die_error(undef, "Open failed.");
1111 my $base = $file_name || "";
1113 if (defined $hash_base && (my %co = git_read_commit($hash_base))) {
1114 print "<div class=\"page_nav\">\n" .
1115 $cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") .
1116 " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog"}, "shortlog") .
1117 " | " . $cgi->a({-href => "$my_uri?p=$project;a=log"}, "log") .
1118 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash_base"}, "commit") .
1119 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash_base"}, "commitdiff") .
1120 " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash_base"}, "tree") . "<br/>\n";
1121 print $cgi->a({-href => "$my_uri?p=$project;a=blob_plain;h=$hash"}, "plain") . "<br/>\n" .
1124 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash_base", -class => "title"}, escapeHTML($co{'title'})) .
1127 print "<div class=\"page_nav\">\n" .
1128 "<br/><br/></div>\n" .
1129 "<div class=\"title\">$hash</div>\n";
1131 if (defined $file_name) {
1132 print "<div class=\"page_path\"><b>$file_name</b></div>\n";
1134 print "<div class=\"page_body\">\n";
1136 while (my $line = <$fd>) {
1139 while ((my $pos = index($line, "\t")) != -1) {
1140 if (my $count = (8 - ($pos % 8))) {
1141 my $spaces = ' ' x $count;
1142 $line =~ s/\t/$spaces/;
1145 printf "<div class=\"pre\"><a id=\"l%i\" href=\"#l%i\" class=\"linenr\">%4i</a> %s</div>\n", $nr, $nr, $nr, escapeHTML($line);
1147 close $fd or print "Reading blob failed.\n";
1152 sub git_blob_plain {
1153 print $cgi->header(-type => "text/plain", -charset => 'utf-8');
1154 open my $fd, "-|", "$gitbin/git-cat-file blob $hash" or return;
1162 if (!defined $hash) {
1163 $hash = git_read_hash("$project/HEAD");
1164 if (defined $file_name) {
1165 my $base = $hash_base || git_read_hash("$project/HEAD");
1166 $hash = git_get_hash_by_path($base, $file_name, "tree");
1168 if (!defined $hash_base) {
1169 $hash_base = git_read_hash("$project/HEAD");
1172 open my $fd, "-|", "$gitbin/git-ls-tree $hash" or die_error(undef, "Open git-ls-tree failed.");
1173 my (@entries) = map { chomp; $_ } <$fd>;
1174 close $fd or die_error(undef, "Reading tree failed.");
1180 if (defined $hash_base && (my %co = git_read_commit($hash_base))) {
1181 $base_key = ";hb=$hash_base";
1182 print "<div class=\"page_nav\">\n" .
1183 $cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") .
1184 " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$hash_base"}, "shortlog") .
1185 " | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$hash_base"}, "log") .
1186 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash_base"}, "commit") .
1187 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash_base"}, "commitdiff") .
1192 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash_base", -class => "title"}, escapeHTML($co{'title'})) . "\n" .
1195 print "<div class=\"page_nav\">\n";
1196 print "<br/><br/></div>\n";
1197 print "<div class=\"title\">$hash</div>\n";
1199 if (defined $file_name) {
1200 $base = "$file_name/";
1201 print "<div class=\"page_path\"><b>/$file_name</b></div>\n";
1203 print "<div class=\"page_path\"><b>/</b></div>\n";
1205 print "<div class=\"page_body\">\n";
1206 print "<table cellspacing=\"0\">\n";
1208 foreach my $line (@entries) {
1209 #'100644 blob 0fa3f3a66fb6a137f6ec2c19351ed4d807070ffa panic.c'
1210 $line =~ m/^([0-9]+) (.+) ([0-9a-fA-F]{40})\t(.+)$/;
1215 $file_key = ";f=$base$t_name";
1217 print "<tr class=\"dark\">\n";
1219 print "<tr class=\"light\">\n";
1222 print "<td style=\"font-family:monospace\">" . mode_str($t_mode) . "</td>\n";
1223 if ($t_type eq "blob") {
1224 print "<td class=\"list\">" .
1225 $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$t_hash" . $base_key . $file_key, -class => "list"}, $t_name) .
1227 "<td class=\"link\">" .
1228 $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$t_hash" . $base_key . $file_key}, "blob") .
1229 " | " . $cgi->a({-href => "$my_uri?p=$project;a=history;h=$hash_base" . $file_key}, "history") .
1231 } elsif ($t_type eq "tree") {
1232 print "<td class=\"list\">" .
1233 $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$t_hash" . $base_key . $file_key}, $t_name) .
1235 "<td class=\"link\">" .
1236 $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$t_hash" . $base_key . $file_key}, "tree") .
1241 print "</table>\n" .
1247 # http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ
1248 open my $fd, "-|", "$gitbin/git-rev-list --max-count=20 " . git_read_hash("$project/HEAD") or die_error(undef, "Open failed.");
1249 my (@revlist) = map { chomp; $_ } <$fd>;
1250 close $fd or die_error(undef, "Reading rev-list failed.");
1252 print $cgi->header(-type => 'text/xml', -charset => 'utf-8');
1253 print "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n".
1254 "<rss version=\"2.0\" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\">\n";
1255 print "<channel>\n";
1256 print "<title>$project</title>\n".
1257 "<link>" . escapeHTML("$my_url?p=$project;a=summary") . "</link>\n".
1258 "<description>$project log</description>\n".
1259 "<language>en</language>\n";
1261 foreach my $commit (@revlist) {
1262 my %co = git_read_commit($commit);
1263 my %cd = date_str($co{'committer_epoch'});
1266 sprintf("%d %s %02d:%02d", $cd{'mday'}, $cd{'month'}, $cd{'hour'}, $cd{'minute'}) . " - " . escapeHTML($co{'title'}) .
1268 "<pubDate>$cd{'rfc2822'}</pubDate>\n" .
1269 "<link>" . escapeHTML("$my_url?p=$project;a=commit;h=$commit") . "</link>\n" .
1270 "<description>" . escapeHTML($co{'title'}) . "</description>\n" .
1271 "<content:encoded>" .
1273 my $comment = $co{'comment'};
1274 foreach my $line (@$comment) {
1275 print "$line<br/>\n";
1278 "</content:encoded>\n" .
1281 print "</channel></rss>";
1285 my @list = git_read_projects();
1287 print $cgi->header(-type => 'text/xml', -charset => 'utf-8');
1288 print "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n".
1289 "<opml version=\"1.0\">\n".
1291 " <title>Git OPML Export</title>\n".
1294 "<outline text=\"git RSS feeds\">\n";
1296 foreach my $pr (@list) {
1298 my $head = git_read_hash("$proj{'path'}/HEAD");
1299 if (!defined $head) {
1302 $ENV{'GIT_DIR'} = "$projectroot/$proj{'path'}";
1303 my %co = git_read_commit($head);
1308 my $path = escapeHTML(chop_str($proj{'path'}, 25, 5));
1309 my $rss = "$my_url?p=$proj{'path'};a=rss";
1310 my $html = "$my_url?p=$proj{'path'};a=summary";
1311 print "<outline type=\"rss\" text=\"$path\" title=\"$path\" xmlUrl=\"$rss\" htmlUrl=\"$html\"/>\n";
1313 print "</outline>\n".
1319 my $head = git_read_hash("$project/HEAD");
1320 if (!defined $hash) {
1323 if (!defined $page) {
1327 print "<div class=\"page_nav\">\n";
1328 print $cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") .
1329 " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$hash"}, "shortlog") .
1331 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash"}, "commit") .
1332 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash"}, "commitdiff") .
1333 " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$hash;hb=$hash"}, "tree") . "<br/>\n";
1335 my $limit = sprintf("--max-count=%i", (100 * ($page+1)));
1336 open my $fd, "-|", "$gitbin/git-rev-list $limit $hash" or die_error(undef, "Open failed.");
1337 my (@revlist) = map { chomp; $_ } <$fd>;
1340 if ($hash ne $head || $page) {
1341 print $cgi->a({-href => "$my_uri?p=$project;a=log"}, "HEAD");
1347 $cgi->a({-href => "$my_uri?p=$project;a=log;h=$hash;pg=" . ($page-1), -accesskey => "p", -title => "Alt-p"}, "prev");
1349 print " ⋅ prev";
1351 if ($#revlist >= (100 * ($page+1)-1)) {
1353 $cgi->a({-href => "$my_uri?p=$project;a=log;h=$hash;pg=" . ($page+1), -accesskey => "n", -title => "Alt-n"}, "next");
1355 print " ⋅ next";
1361 $cgi->a({-href => "$my_uri?p=$project;a=summary", -class => "title"}, " ") .
1363 my %co = git_read_commit($hash);
1364 print "<div class=\"page_body\"> Last change $co{'age_string'}.<br/><br/></div>\n";
1366 for (my $i = ($page * 100); $i <= $#revlist; $i++) {
1367 my $commit = $revlist[$i];
1368 my %co = git_read_commit($commit);
1370 my %ad = date_str($co{'author_epoch'});
1372 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit", -class => "title"},
1373 "<span class=\"age\">$co{'age_string'}</span>" . escapeHTML($co{'title'})) . "\n" .
1375 print "<div class=\"title_text\">\n" .
1376 "<div class=\"log_link\">\n" .
1377 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"}, "commit") .
1378 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$commit"}, "commitdiff") .
1381 "<i>" . escapeHTML($co{'author_name'}) . " [$ad{'rfc2822'}]</i><br/>\n" .
1383 "<div class=\"log_body\">\n";
1384 my $comment = $co{'comment'};
1386 foreach my $line (@$comment) {
1387 if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
1398 print escapeHTML($line) . "<br/>\n";
1409 my %co = git_read_commit($hash);
1411 die_error(undef, "Unknown commit object.");
1413 my %ad = date_str($co{'author_epoch'}, $co{'author_tz'});
1414 my %cd = date_str($co{'committer_epoch'}, $co{'committer_tz'});
1418 if (!defined $co{'parent'}) {
1421 open my $fd, "-|", "$gitbin/git-diff-tree -r -M $root $co{'parent'} $hash" or die_error(undef, "Open failed.");
1422 @difftree = map { chomp; $_ } <$fd>;
1423 close $fd or die_error(undef, "Reading diff-tree failed.");
1425 print "<div class=\"page_nav\">\n" .
1426 $cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") .
1427 " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$hash"}, "shortlog") .
1428 " | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$hash"}, "log") .
1430 if (defined $co{'parent'}) {
1431 print " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash"}, "commitdiff");
1433 print " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash"}, "tree") . "\n" .
1434 "<br/><br/></div>\n";
1435 if (defined $co{'parent'}) {
1437 $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash", -class => "title"}, escapeHTML($co{'title'})) . "\n" .
1441 $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash", -class => "title"}, escapeHTML($co{'title'})) . "\n" .
1444 print "<div class=\"title_text\">\n" .
1445 "<table cellspacing=\"0\">\n";
1446 print "<tr><td>author</td><td>" . escapeHTML($co{'author'}) . "</td></tr>\n".
1448 "<td></td><td> $ad{'rfc2822'}";
1449 if ($ad{'hour_local'} < 6) {
1450 printf(" (<span style=\"color: #cc0000;\">%02d:%02d</span> %s)", $ad{'hour_local'}, $ad{'minute_local'}, $ad{'tz_local'});
1452 printf(" (%02d:%02d %s)", $ad{'hour_local'}, $ad{'minute_local'}, $ad{'tz_local'});
1456 print "<tr><td>committer</td><td>" . escapeHTML($co{'committer'}) . "</td></tr>\n";
1457 print "<tr><td></td><td> $cd{'rfc2822'}" . sprintf(" (%02d:%02d %s)", $cd{'hour_local'}, $cd{'minute_local'}, $cd{'tz_local'}) . "</td></tr>\n";
1458 print "<tr><td>commit</td><td style=\"font-family:monospace\">$hash</td></tr>\n";
1461 "<td style=\"font-family:monospace\">" .
1462 $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash", class => "list"}, $co{'tree'}) .
1464 "<td class=\"link\">" . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash"}, "tree") .
1467 my $parents = $co{'parents'};
1468 foreach my $par (@$parents) {
1471 "<td style=\"font-family:monospace\">" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$par", class => "list"}, $par) . "</td>" .
1472 "<td class=\"link\">" .
1473 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$par"}, "commit") .
1474 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash;hp=$par"}, "commitdiff") .
1480 print "<div class=\"page_body\">\n";
1481 my $comment = $co{'comment'};
1484 foreach my $line (@$comment) {
1485 # print only one empty line
1487 if ($empty || $signed) {
1494 if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
1496 print "<span style=\"color: #888888\">" . escapeHTML($line) . "</span><br/>\n";
1499 $line = escapeHTML($line);
1500 $line =~ s/ / /g;
1501 print "$line<br/>\n";
1505 print "<div class=\"list_head\">\n";
1506 if ($#difftree > 10) {
1507 print(($#difftree + 1) . " files changed:\n");
1510 print "<table cellspacing=\"0\">\n";
1512 foreach my $line (@difftree) {
1513 # ':100644 100644 03b218260e99b78c6df0ed378e59ed9205ccc96d 3b93d5e7cc7f7dd4ebed13a5cc1a4ad976fc94d8 M ls-files.c'
1514 # ':100644 100644 7f9281985086971d3877aca27704f2aaf9c448ce bc190ebc71bbd923f2b728e505408f5e54bd073a M rev-tree.c'
1515 $line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)([0-9]{0,3})\t(.*)$/;
1521 my $similarity = $6;
1523 #print "$line ($status)<br/>\n";
1525 print "<tr class=\"dark\">\n";
1527 print "<tr class=\"light\">\n";
1530 if ($status eq "A") {
1532 if (S_ISREG(oct $to_mode)) {
1533 $mode_chng = sprintf(" with mode: %04o", (oct $to_mode) & 0777);
1536 $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$to_id;hp=$hash;f=$file", -class => "list"}, escapeHTML($file)) . "</td>\n" .
1537 "<td><span style=\"color: #008000;\">[new " . file_type($to_mode) . "$mode_chng]</span></td>\n" .
1538 "<td class=\"link\">" . $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file"}, "blob") . "</td>\n";
1539 } elsif ($status eq "D") {
1541 $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$from_id;hb=$hash;f=$file", -class => "list"}, escapeHTML($file)) . "</td>\n" .
1542 "<td><span style=\"color: #c00000;\">[deleted " . file_type($from_mode). "]</span></td>\n" .
1543 "<td class=\"link\">" .
1544 $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$from_id;hb=$hash;f=$file"}, "blob") .
1545 " | " . $cgi->a({-href => "$my_uri?p=$project;a=history;h=$hash;f=$file"}, "history") .
1547 } elsif ($status eq "M" || $status eq "T") {
1548 my $mode_chnge = "";
1549 if ($from_mode != $to_mode) {
1550 $mode_chnge = " <span style=\"color: #777777;\">[changed";
1551 if (((oct $from_mode) & S_IFMT) != ((oct $to_mode) & S_IFMT)) {
1552 $mode_chnge .= " from " . file_type($from_mode) . " to " . file_type($to_mode);
1554 if (((oct $from_mode) & 0777) != ((oct $to_mode) & 0777)) {
1555 if (S_ISREG($from_mode) && S_ISREG($to_mode)) {
1556 $mode_chnge .= sprintf(" mode: %04o->%04o", (oct $from_mode) & 0777, (oct $to_mode) & 0777);
1557 } elsif (S_ISREG($to_mode)) {
1558 $mode_chnge .= sprintf(" mode: %04o", (oct $to_mode) & 0777);
1561 $mode_chnge .= "]</span>\n";
1564 if ($to_id ne $from_id) {
1565 print $cgi->a({-href => "$my_uri?p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$file", -class => "list"}, escapeHTML($file));
1567 print $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file", -class => "list"}, escapeHTML($file));
1570 "<td>$mode_chnge</td>\n" .
1571 "<td class=\"link\">";
1572 print $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file"}, "blob");
1573 if ($to_id ne $from_id) {
1574 print " | " . $cgi->a({-href => "$my_uri?p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$file"}, "diff");
1576 print " | " . $cgi->a({-href => "$my_uri?p=$project;a=history;h=$hash;f=$file"}, "history") . "\n";
1578 } elsif ($status eq "R") {
1579 my ($from_file, $to_file) = split "\t", $file;
1581 if ($from_mode != $to_mode) {
1582 $mode_chng = sprintf(", mode: %04o", (oct $to_mode) & 0777);
1585 $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$to_file", -class => "list"}, escapeHTML($to_file)) . "</td>\n" .
1586 "<td><span style=\"color: #777777;\">[moved from " .
1587 $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$from_id;hb=$hash;f=$from_file", -class => "list"}, escapeHTML($from_file)) .
1588 " with " . (int $similarity) . "% similarity$mode_chng]</span></td>\n" .
1589 "<td class=\"link\">" .
1590 $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$to_file"}, "blob");
1591 if ($to_id ne $from_id) {
1592 print " | " . $cgi->a({-href => "$my_uri?p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$to_file"}, "diff");
1603 mkdir($git_temp, 0700);
1605 if (defined $hash_base && (my %co = git_read_commit($hash_base))) {
1606 print "<div class=\"page_nav\">\n" .
1607 $cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") .
1608 " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog"}, "shortlog") .
1609 " | " . $cgi->a({-href => "$my_uri?p=$project;a=log"}, "log") .
1610 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash_base"}, "commit") .
1611 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash_base"}, "commitdiff") .
1612 " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash_base"}, "tree") .
1614 print $cgi->a({-href => "$my_uri?p=$project;a=blobdiff_plain;h=$hash;hp=$hash_parent"}, "plain") .
1617 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash_base", -class => "title"}, escapeHTML($co{'title'})) . "\n" .
1620 print "<div class=\"page_nav\">\n" .
1621 "<br/><br/></div>\n" .
1622 "<div class=\"title\">$hash vs $hash_parent</div>\n";
1624 if (defined $file_name) {
1625 print "<div class=\"page_path\"><b>/$file_name</b></div>\n";
1627 print "<div class=\"page_body\">\n" .
1628 "<div class=\"diff_info\">blob:" .
1629 $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$hash_parent;hb=$hash_base;f=$file_name"}, $hash_parent) .
1631 $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$hash;hb=$hash_base;f=$file_name"}, $hash) .
1633 git_diff_print($hash_parent, $file_name || $hash_parent, $hash, $file_name || $hash);
1638 sub git_blobdiff_plain {
1639 mkdir($git_temp, 0700);
1640 print $cgi->header(-type => "text/plain", -charset => 'utf-8');
1641 git_diff_print($hash_parent, $file_name || $hash_parent, $hash, $file_name || $hash, "plain");
1644 sub git_commitdiff {
1645 mkdir($git_temp, 0700);
1646 my %co = git_read_commit($hash);
1648 die_error(undef, "Unknown commit object.");
1650 if (!defined $hash_parent) {
1651 $hash_parent = $co{'parent'};
1653 open my $fd, "-|", "$gitbin/git-diff-tree -r $hash_parent $hash" or die_error(undef, "Open failed.");
1654 my (@difftree) = map { chomp; $_ } <$fd>;
1655 close $fd or die_error(undef, "Reading diff-tree failed.");
1658 print "<div class=\"page_nav\">\n" .
1659 $cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") .
1660 " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$hash"}, "shortlog") .
1661 " | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$hash"}, "log") .
1662 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash"}, "commit") .
1664 " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash"}, "tree") . "<br/>\n";
1665 print $cgi->a({-href => "$my_uri?p=$project;a=commitdiff_plain;h=$hash;hp=$hash_parent"}, "plain") . "\n" .
1668 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash", -class => "title"}, escapeHTML($co{'title'})) . "\n" .
1670 print "<div class=\"page_body\">\n";
1671 my $comment = $co{'comment'};
1674 my @log = @$comment;
1675 # remove first and empty lines after that
1677 while (defined $log[0] && $log[0] eq "") {
1680 foreach my $line (@log) {
1681 if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
1692 $line = escapeHTML($line);
1693 $line =~ s/ / /g;
1694 print "$line<br/>\n";
1697 foreach my $line (@difftree) {
1698 # ':100644 100644 03b218260e99b78c6df0ed378e59ed9205ccc96d 3b93d5e7cc7f7dd4ebed13a5cc1a4ad976fc94d8 M ls-files.c'
1699 # ':100644 100644 7f9281985086971d3877aca27704f2aaf9c448ce bc190ebc71bbd923f2b728e505408f5e54bd073a M rev-tree.c'
1700 $line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)\t(.*)$/;
1707 if ($status eq "A") {
1708 print "<div class=\"diff_info\">" . file_type($to_mode) . ":" .
1709 $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file"}, $to_id) . "(new)" .
1711 git_diff_print(undef, "/dev/null", $to_id, "b/$file");
1712 } elsif ($status eq "D") {
1713 print "<div class=\"diff_info\">" . file_type($from_mode) . ":" .
1714 $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$from_id;hb=$hash;f=$file"}, $from_id) . "(deleted)" .
1716 git_diff_print($from_id, "a/$file", undef, "/dev/null");
1717 } elsif ($status eq "M") {
1718 if ($from_id ne $to_id) {
1719 print "<div class=\"diff_info\">" .
1720 file_type($from_mode) . ":" . $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$from_id;hb=$hash;f=$file"}, $from_id) .
1722 file_type($to_mode) . ":" . $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file"}, $to_id);
1724 git_diff_print($from_id, "a/$file", $to_id, "b/$file");
1733 sub git_commitdiff_plain {
1734 mkdir($git_temp, 0700);
1735 open my $fd, "-|", "$gitbin/git-diff-tree -r $hash_parent $hash" or die_error(undef, "Open failed.");
1736 my (@difftree) = map { chomp; $_ } <$fd>;
1737 close $fd or die_error(undef, "Reading diff-tree failed.");
1739 # try to figure out the next tag after this commit
1742 my $tags = git_read_refs("refs/tags");
1743 foreach my $entry (@$tags) {
1745 $taghash{$tag{'id'}} = $tag{'name'};
1747 open $fd, "-|", "$gitbin/git-rev-list HEAD";
1748 while (my $commit = <$fd>) {
1750 if ($taghash{$commit}) {
1751 $tagname = $taghash{$commit};
1753 if ($commit eq $hash) {
1759 print $cgi->header(-type => "text/plain", -charset => 'utf-8');
1760 my %co = git_read_commit($hash);
1761 my %ad = date_str($co{'author_epoch'}, $co{'author_tz'});
1762 my $comment = $co{'comment'};
1763 print "From: $co{'author'}\n" .
1764 "Date: $ad{'rfc2822'} ($ad{'tz_local'})\n".
1765 "Subject: $co{'title'}\n";
1766 if (defined $tagname) {
1767 print "X-Git-Tag: $tagname\n";
1769 print "X-Git-Url: $my_url?p=$project;a=commitdiff;h=$hash\n" .
1772 foreach my $line (@$comment) {;
1777 foreach my $line (@difftree) {
1778 $line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)\t(.*)$/;
1783 if ($status eq "A") {
1784 git_diff_print(undef, "/dev/null", $to_id, "b/$file", "plain");
1785 } elsif ($status eq "D") {
1786 git_diff_print($from_id, "a/$file", undef, "/dev/null", "plain");
1787 } elsif ($status eq "M") {
1788 git_diff_print($from_id, "a/$file", $to_id, "b/$file", "plain");
1794 if (!defined $hash) {
1795 $hash = git_read_hash("$project/HEAD");
1797 my %co = git_read_commit($hash);
1799 die_error(undef, "Unknown commit object.");
1802 print "<div class=\"page_nav\">\n" .
1803 $cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") .
1804 " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog"}, "shortlog") .
1805 " | " . $cgi->a({-href => "$my_uri?p=$project;a=log"}, "log") .
1806 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash"}, "commit") .
1807 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash"}, "commitdiff") .
1808 " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash"}, "tree") .
1812 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash", -class => "title"}, escapeHTML($co{'title'})) . "\n" .
1814 print "<div class=\"page_path\"><b>/$file_name</b><br/></div>\n";
1816 open my $fd, "-|", "$gitbin/git-rev-list $hash | $gitbin/git-diff-tree -r --stdin $file_name";
1818 print "<table cellspacing=\"0\">\n";
1820 while (my $line = <$fd>) {
1821 if ($line =~ m/^([0-9a-fA-F]{40})/){
1825 if ($line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)\t(.*)$/ && (defined $commit)) {
1826 my %co = git_read_commit($commit);
1831 print "<tr class=\"dark\">\n";
1833 print "<tr class=\"light\">\n";
1836 print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
1837 "<td><i>" . escapeHTML(chop_str($co{'author_name'}, 15, 3)) . "</i></td>\n" .
1838 "<td>" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit", -class => "list"}, "<b>" .
1839 escapeHTML(chop_str($co{'title'}, 50)) . "</b>") . "</td>\n" .
1840 "<td class=\"link\">" .
1841 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"}, "commit") .
1842 " | " . $cgi->a({-href => "$my_uri?p=$project;a=blob;hb=$commit;f=$file_name"}, "blob");
1843 my $blob = git_get_hash_by_path($hash, $file_name);
1844 my $blob_parent = git_get_hash_by_path($commit, $file_name);
1845 if (defined $blob && defined $blob_parent && $blob ne $blob_parent) {
1847 $cgi->a({-href => "$my_uri?p=$project;a=blobdiff;h=$blob;hp=$blob_parent;hb=$commit;f=$file_name"},
1861 if (!defined $searchtext) {
1862 die_error("", "Text field empty.");
1864 if (!defined $hash) {
1865 $hash = git_read_hash("$project/HEAD");
1867 my %co = git_read_commit($hash);
1869 die_error(undef, "Unknown commit object.");
1871 # pickaxe may take all resources of your box and run for several minutes
1872 # with every query - so decide by yourself how public you make this feature :)
1873 my $commit_search = 1;
1874 my $author_search = 0;
1875 my $committer_search = 0;
1876 my $pickaxe_search = 0;
1877 if ($searchtext =~ s/^author\\://i) {
1879 } elsif ($searchtext =~ s/^committer\\://i) {
1880 $committer_search = 1;
1881 } elsif ($searchtext =~ s/^pickaxe\\://i) {
1883 $pickaxe_search = 1;
1886 print "<div class=\"page_nav\">\n" .
1887 $cgi->a({-href => "$my_uri?p=$project;a=summary;h=$hash"}, "summary") .
1888 " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog"}, "shortlog") .
1889 " | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$hash"}, "log") .
1890 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash"}, "commit") .
1891 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash"}, "commitdiff") .
1892 " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash"}, "tree") .
1897 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash", -class => "title"}, escapeHTML($co{'title'})) . "\n" .
1899 print "<table cellspacing=\"0\">\n";
1901 if ($commit_search) {
1903 open my $fd, "-|", "$gitbin/git-rev-list --header $hash";
1904 while (my $commit_text = <$fd>) {
1905 if (!grep m/$searchtext/i, $commit_text) {
1908 if ($author_search && !grep m/\nauthor .*$searchtext/i, $commit_text) {
1911 if ($committer_search && !grep m/\ncommitter .*$searchtext/i, $commit_text) {
1914 my @commit_lines = split "\n", $commit_text;
1915 my $commit = shift @commit_lines;
1916 my %co = git_read_commit($commit, \@commit_lines);
1921 print "<tr class=\"dark\">\n";
1923 print "<tr class=\"light\">\n";
1926 print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
1927 "<td><i>" . escapeHTML(chop_str($co{'author_name'}, 15, 5)) . "</i></td>\n" .
1929 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit", -class => "list"}, "<b>" . escapeHTML(chop_str($co{'title'}, 50)) . "</b><br/>");
1930 my $comment = $co{'comment'};
1931 foreach my $line (@$comment) {
1932 if ($line =~ m/^(.*)($searchtext)(.*)$/i) {
1933 my $lead = escapeHTML($1) || "";
1934 $lead = chop_str($lead, 30, 10);
1935 my $match = escapeHTML($2) || "";
1936 my $trail = escapeHTML($3) || "";
1937 $trail = chop_str($trail, 30, 10);
1938 my $text = "$lead<span style=\"color:#e00000\">$match</span>$trail";
1939 print chop_str($text, 80, 5) . "<br/>\n";
1943 "<td class=\"link\">" .
1944 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"}, "commit") .
1945 " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$commit"}, "tree");
1952 if ($pickaxe_search) {
1954 open my $fd, "-|", "$gitbin/git-rev-list $hash | $gitbin/git-diff-tree -r --stdin -S$searchtext";
1957 while (my $line = <$fd>) {
1958 if (%co && $line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)\t(.*)$/) {
1961 $set{'from_id'} = $3;
1963 $set{'id'} = $set{'to_id'};
1964 if ($set{'id'} =~ m/0{40}/) {
1965 $set{'id'} = $set{'from_id'};
1967 if ($set{'id'} =~ m/0{40}/) {
1971 } elsif ($line =~ m/^([0-9a-fA-F]{40}) /){
1974 print "<tr class=\"dark\">\n";
1976 print "<tr class=\"light\">\n";
1979 print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
1980 "<td><i>" . escapeHTML(chop_str($co{'author_name'}, 15, 5)) . "</i></td>\n" .
1982 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$co{'id'}", -class => "list"}, "<b>" .
1983 escapeHTML(chop_str($co{'title'}, 50)) . "</b><br/>");
1984 while (my $setref = shift @files) {
1986 print $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$set{'id'};hb=$co{'id'};f=$set{'file'}", class => "list"},
1987 "<span style=\"color:#e00000\">" . escapeHTML($set{'file'}) . "</span>") .
1991 "<td class=\"link\">" .
1992 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$co{'id'}"}, "commit") .
1993 " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$co{'id'}"}, "tree");
1997 %co = git_read_commit($1);
2007 my $head = git_read_hash("$project/HEAD");
2008 if (!defined $hash) {
2011 if (!defined $page) {
2015 print "<div class=\"page_nav\">\n" .
2016 $cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") .
2018 " | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$hash"}, "log") .
2019 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash"}, "commit") .
2020 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash"}, "commitdiff") .
2021 " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$hash;hb=$hash"}, "tree") . "<br/>\n";
2023 my $limit = sprintf("--max-count=%i", (100 * ($page+1)));
2024 open my $fd, "-|", "$gitbin/git-rev-list $limit $hash" or die_error(undef, "Open failed.");
2025 my (@revlist) = map { chomp; $_ } <$fd>;
2028 if ($hash ne $head || $page) {
2029 print $cgi->a({-href => "$my_uri?p=$project;a=shortlog"}, "HEAD");
2035 $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$hash;pg=" . ($page-1), -accesskey => "p", -title => "Alt-p"}, "prev");
2037 print " ⋅ prev";
2039 if ($#revlist >= (100 * ($page+1)-1)) {
2041 $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$hash;pg=" . ($page+1), -accesskey => "n", -title => "Alt-n"}, "next");
2043 print " ⋅ next";
2048 $cgi->a({-href => "$my_uri?p=$project;a=summary", -class => "title"}, " ") .
2050 print "<table cellspacing=\"0\">\n";
2052 for (my $i = ($page * 100); $i <= $#revlist; $i++) {
2053 my $commit = $revlist[$i];
2054 my %co = git_read_commit($commit);
2055 my %ad = date_str($co{'author_epoch'});
2057 print "<tr class=\"dark\">\n";
2059 print "<tr class=\"light\">\n";
2062 print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
2063 "<td><i>" . escapeHTML(chop_str($co{'author_name'}, 10)) . "</i></td>\n" .
2064 "<td>" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit", -class => "list"}, "<b>" .
2065 escapeHTML($co{'title_short'}) . "</b>") . "</td>\n" .
2066 "<td class=\"link\">" .
2067 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"}, "commit") .
2068 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$commit"}, "commitdiff") .
2072 if ($#revlist >= (100 * ($page+1)-1)) {
2075 $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$hash;pg=" . ($page+1), -title => "Alt-n"}, "next") .