3 # gitweb - simple web interface to track changes in git repositories
5 # (C) 2005-2006, Kay Sievers <kay.sievers@vrfy.org>
6 # (C) 2005, Christian Gierke
8 # This program is licensed under the GPLv2
12 use CGI
qw(:standard :escapeHTML -nosticky);
13 use CGI
::Util
qw(unescape);
14 use CGI
::Carp
qw(fatalsToBrowser);
17 binmode STDOUT
, ':utf8';
21 my $my_url = $cgi->url();
22 my $my_uri = $cgi->url(-absolute
=> 1);
25 # absolute fs-path which will be prepended to the project path
26 #my $projectroot = "/pub/scm";
27 my $projectroot = "/home/kay/public_html/pub/scm";
29 # location of the git-core binaries
30 my $gitbin = "/usr/bin";
32 # location for temporary files needed for diffs
33 my $git_temp = "/tmp/gitweb";
35 # target of the home link on top of all pages
36 my $home_link = $my_uri;
38 # html text to include at home page
39 my $home_text = "indextext.html";
41 # source of projects list
42 #my $projects_list = $projectroot;
43 my $projects_list = "index/index.aux";
45 # input validation and dispatch
46 my $action = $cgi->param('a');
47 if (defined $action) {
48 if ($action =~ m/[^0-9a-zA-Z\.\-_]/) {
50 die_error
(undef, "Invalid action parameter.");
52 if ($action eq "git-logo.png") {
55 } elsif ($action eq "opml") {
61 my $order = $cgi->param('o');
63 if ($order =~ m/[^0-9a-zA-Z_]/) {
65 die_error
(undef, "Invalid order parameter.");
69 my $project = $cgi->param('p');
70 if (defined $project) {
71 $project = validate_input
($project);
72 if (!defined($project)) {
73 die_error
(undef, "Invalid project parameter.");
75 if (!(-d
"$projectroot/$project")) {
77 die_error
(undef, "No such directory.");
79 if (!(-e
"$projectroot/$project/HEAD")) {
81 die_error
(undef, "No such project.");
83 $rss_link = "<link rel=\"alternate\" title=\"" . esc_param
($project) . " log\" href=\"" .
84 "$my_uri?" . esc_param
("p=$project;a=rss") . "\" type=\"application/rss+xml\"/>";
85 $ENV{'GIT_DIR'} = "$projectroot/$project";
91 my $file_name = $cgi->param('f');
92 if (defined $file_name) {
93 $file_name = validate_input
($file_name);
94 if (!defined($file_name)) {
95 die_error
(undef, "Invalid file parameter.");
99 my $hash = $cgi->param('h');
101 $hash = validate_input
($hash);
102 if (!defined($hash)) {
103 die_error
(undef, "Invalid hash parameter.");
107 my $hash_parent = $cgi->param('hp');
108 if (defined $hash_parent) {
109 $hash_parent = validate_input
($hash_parent);
110 if (!defined($hash_parent)) {
111 die_error
(undef, "Invalid hash parent parameter.");
115 my $hash_base = $cgi->param('hb');
116 if (defined $hash_base) {
117 $hash_base = validate_input
($hash_base);
118 if (!defined($hash_base)) {
119 die_error
(undef, "Invalid hash base parameter.");
123 my $page = $cgi->param('pg');
125 if ($page =~ m/[^0-9]$/) {
127 die_error
(undef, "Invalid page parameter.");
131 my $searchtext = $cgi->param('s');
132 if (defined $searchtext) {
133 if ($searchtext =~ m/[^a-zA-Z0-9_\.\/\
-\
+\
:\@
]/) {
135 die_error
(undef, "Invalid search parameter.");
137 $searchtext = quotemeta $searchtext;
143 if ($input =~ m/^[0-9a-fA-F]{40}$/) {
146 if ($input =~ m/(^|\/)(|\
.|\
.\
.)($|\
/)/) {
149 if ($input =~ m/[^a-zA-Z0-9_\x80-\xff\ \t\.\/\
-\
+\#\
~\
%]/) {
155 if (!defined $action || $action eq "summary") {
158 } elsif ($action eq "heads") {
161 } elsif ($action eq "tags") {
164 } elsif ($action eq "blob") {
167 } elsif ($action eq "blob_plain") {
170 } elsif ($action eq "tree") {
173 } elsif ($action eq "rss") {
176 } elsif ($action eq "commit") {
179 } elsif ($action eq "log") {
182 } elsif ($action eq "blobdiff") {
185 } elsif ($action eq "blobdiff_plain") {
186 git_blobdiff_plain
();
188 } elsif ($action eq "commitdiff") {
191 } elsif ($action eq "commitdiff_plain") {
192 git_commitdiff_plain
();
194 } elsif ($action eq "history") {
197 } elsif ($action eq "search") {
200 } elsif ($action eq "shortlog") {
203 } elsif ($action eq "tag") {
206 } elsif ($action eq "blame") {
211 die_error
(undef, "Unknown action.");
215 # quote unsafe chars, but keep the slash, even when it's not
216 # correct, but quoted slashes look too horrible in bookmarks
219 $str =~ s/([^A-Za-z0-9\-_.~();\/;?:@&=])/sprintf
("%%%02X", ord($1))/eg
;
225 # replace invalid utf8 character with SUBSTITUTION sequence
228 $str = decode
("utf8", $str, Encode
::FB_DEFAULT
);
229 $str = escapeHTML
($str);
233 # git may return quoted and escaped filenames
236 if ($str =~ m/^"(.*)"$/) {
238 $str =~ s/\\([0-7]{1,3})/chr(oct($1))/eg;
243 sub git_header_html
{
244 my $status = shift || "200 OK";
248 if (defined $project) {
249 $title .= " - $project";
250 if (defined $action) {
251 $title .= "/$action";
254 print $cgi->header(-type
=>'text/html', -charset
=> 'utf-8', -status
=> $status, -expires
=> $expires);
256 <?xml version="1.0" encoding="utf-8"?>
257 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
258 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
259 <!-- git web interface v$version, (C) 2005-2006, Kay Sievers <kay.sievers\@vrfy.org>, Christian Gierke -->
261 <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
262 <meta name="robots" content="index, nofollow"/>
263 <title>$title</title>
265 <style type="text/css">
267 font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px;
268 margin:10px; background-color:#ffffff; color:#000000;
271 a:hover, a:visited, a:active { color:#880000; }
272 div.page_header { height:25px; padding:8px; font-size:18px; font-weight:bold; background-color:#d9d8d1; }
273 div.page_header a:visited, a.header { color:#0000cc; }
274 div.page_header a:hover { color:#880000; }
275 div.page_nav { padding:8px; }
276 div.page_nav a:visited { color:#0000cc; }
277 div.page_path { padding:8px; border:solid #d9d8d1; border-width:0px 0px 1px}
278 div.page_footer { height:17px; padding:4px 8px; background-color: #d9d8d1; }
279 div.page_footer_text { float:left; color:#555555; font-style:italic; }
280 div.page_body { padding:8px; }
282 display:block; padding:6px 8px;
283 font-weight:bold; background-color:#edece6; text-decoration:none; color:#000000;
285 a.title:hover { background-color: #d9d8d1; }
286 div.title_text { padding:6px 0px; border: solid #d9d8d1; border-width:0px 0px 1px; }
287 div.log_body { padding:8px 8px 8px 150px; }
288 span.age { position:relative; float:left; width:142px; font-style:italic; }
291 font-size:10px; font-family:sans-serif; font-style:normal;
292 position:relative; float:left; width:136px;
294 div.list_head { padding:6px 8px 4px; border:solid #d9d8d1; border-width:1px 0px 0px; font-style:italic; }
295 a.list { text-decoration:none; color:#000000; }
296 a.list:hover { text-decoration:underline; color:#880000; }
297 a.text { text-decoration:none; color:#0000cc; }
298 a.text:visited { text-decoration:none; color:#880000; }
299 a.text:hover { text-decoration:underline; color:#880000; }
300 table { padding:8px 4px; }
301 th { padding:2px 5px; font-size:12px; text-align:left; }
302 tr.light:hover { background-color:#edece6; }
303 tr.dark { background-color:#f6f6f0; }
304 tr.dark:hover { background-color:#edece6; }
305 td { padding:2px 5px; font-size:12px; vertical-align:top; }
306 td.link { padding:2px 5px; font-family:sans-serif; font-size:10px; }
307 div.pre { font-family:monospace; font-size:12px; white-space:pre; }
308 div.diff_info { font-family:monospace; color:#000099; background-color:#edece6; font-style:italic; }
309 div.index_include { border:solid #d9d8d1; border-width:0px 0px 1px; padding:12px 8px; }
310 div.search { margin:4px 8px; position:absolute; top:56px; right:12px }
311 a.linenr { color:#999999; text-decoration:none }
313 float:right; padding:3px 0px; width:35px; line-height:10px;
314 border:1px solid; border-color:#fcc7a5 #7d3302 #3e1a01 #ff954e;
315 color:#ffffff; background-color:#ff6600;
316 font-weight:bold; font-family:sans-serif; font-size:10px;
317 text-align:center; text-decoration:none;
319 a.rss_logo:hover { background-color:#ee5500; }
321 padding:0px 4px; font-size:10px; font-weight:normal;
322 background-color:#ffffaa; border:1px solid; border-color:#ffffcc #ffee00 #ffee00 #ffffcc;
328 print "<div class=\"page_header\">\n" .
329 "<a href=\"http://www.kernel.org/pub/software/scm/git/docs/\" title=\"git documentation\">" .
330 "<img src=\"$my_uri?" . esc_param
("a=git-logo.png") . "\" width=\"72\" height=\"27\" alt=\"git\" style=\"float:right; border-width:0px;\"/>" .
332 print $cgi->a({-href
=> esc_param
($home_link)}, "projects") . " / ";
333 if (defined $project) {
334 print $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=summary")}, esc_html
($project));
335 if (defined $action) {
339 if (!defined $searchtext) {
344 $search_hash = $hash;
346 $search_hash = "HEAD";
348 $cgi->param("a", "search");
349 $cgi->param("h", $search_hash);
350 print $cgi->startform(-method
=> "get", -action
=> $my_uri) .
351 "<div class=\"search\">\n" .
352 $cgi->hidden(-name
=> "p") . "\n" .
353 $cgi->hidden(-name
=> "a") . "\n" .
354 $cgi->hidden(-name
=> "h") . "\n" .
355 $cgi->textfield(-name
=> "s", -value
=> $searchtext) . "\n" .
357 $cgi->end_form() . "\n";
362 sub git_footer_html
{
363 print "<div class=\"page_footer\">\n";
364 if (defined $project) {
365 my $descr = git_read_description
($project);
366 if (defined $descr) {
367 print "<div class=\"page_footer_text\">" . esc_html
($descr) . "</div>\n";
369 print $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=rss"), -class => "rss_logo"}, "RSS") . "\n";
371 print $cgi->a({-href
=> "$my_uri?" . esc_param
("a=opml"), -class => "rss_logo"}, "OPML") . "\n";
379 my $status = shift || "403 Forbidden";
380 my $error = shift || "Malformed query, file missing or permission denied";
382 git_header_html
($status);
383 print "<div class=\"page_body\">\n" .
385 "$status - $error\n" .
395 open my $fd, "-|", "$gitbin/git-cat-file -t $hash" or return;
404 my $oENV = $ENV{'GIT_DIR'};
406 $ENV{'GIT_DIR'} = "$projectroot/$project";
407 if (open my $fd, "-|", "$gitbin/git-rev-parse", "--verify", "HEAD") {
410 if (defined $head && $head =~ /^([0-9a-fA-F]{40})$/) {
415 $ENV{'GIT_DIR'} = $oENV;
423 open my $fd, "$projectroot/$path" or return undef;
427 if ($head =~ m/^[0-9a-fA-F]{40}$/) {
432 sub git_read_description
{
435 open my $fd, "$projectroot/$path/description" or return undef;
447 open my $fd, "-|", "$gitbin/git-cat-file tag $tag_id" or return;
448 $tag{'id'} = $tag_id;
449 while (my $line = <$fd>) {
451 if ($line =~ m/^object ([0-9a-fA-F]{40})$/) {
453 } elsif ($line =~ m/^type (.+)$/) {
455 } elsif ($line =~ m/^tag (.+)$/) {
457 } elsif ($line =~ m/^tagger (.*) ([0-9]+) (.*)$/) {
461 } elsif ($line =~ m/--BEGIN/) {
462 push @comment, $line;
464 } elsif ($line eq "") {
468 push @comment, <$fd>;
469 $tag{'comment'} = \
@comment;
471 if (!defined $tag{'name'}) {
481 if ($age > 60*60*24*365*2) {
482 $age_str = (int $age/60/60/24/365);
483 $age_str .= " years ago";
484 } elsif ($age > 60*60*24*(365/12)*2) {
485 $age_str = int $age/60/60/24/(365/12);
486 $age_str .= " months ago";
487 } elsif ($age > 60*60*24*7*2) {
488 $age_str = int $age/60/60/24/7;
489 $age_str .= " weeks ago";
490 } elsif ($age > 60*60*24*2) {
491 $age_str = int $age/60/60/24;
492 $age_str .= " days ago";
493 } elsif ($age > 60*60*2) {
494 $age_str = int $age/60/60;
495 $age_str .= " hours ago";
496 } elsif ($age > 60*2) {
497 $age_str = int $age/60;
498 $age_str .= " min ago";
501 $age_str .= " sec ago";
503 $age_str .= " right now";
508 sub git_read_commit
{
509 my $commit_id = shift;
510 my $commit_text = shift;
515 if (defined $commit_text) {
516 @commit_lines = @
$commit_text;
519 open my $fd, "-|", "$gitbin/git-rev-list --header --parents --max-count=1 $commit_id" or return;
520 @commit_lines = split '\n', <$fd>;
525 my $header = shift @commit_lines;
526 if (!($header =~ m/^[0-9a-fA-F]{40}/)) {
529 ($co{'id'}, my @parents) = split ' ', $header;
530 $co{'parents'} = \
@parents;
531 $co{'parent'} = $parents[0];
532 while (my $line = shift @commit_lines) {
533 last if $line eq "\n";
534 if ($line =~ m/^tree ([0-9a-fA-F]{40})$/) {
536 } elsif ($line =~ m/^author (.*) ([0-9]+) (.*)$/) {
538 $co{'author_epoch'} = $2;
539 $co{'author_tz'} = $3;
540 if ($co{'author'} =~ m/^([^<]+) </) {
541 $co{'author_name'} = $1;
543 $co{'author_name'} = $co{'author'};
545 } elsif ($line =~ m/^committer (.*) ([0-9]+) (.*)$/) {
546 $co{'committer'} = $1;
547 $co{'committer_epoch'} = $2;
548 $co{'committer_tz'} = $3;
549 $co{'committer_name'} = $co{'committer'};
550 $co{'committer_name'} =~ s/ <.*//;
553 if (!defined $co{'tree'}) {
557 foreach my $title (@commit_lines) {
560 $co{'title'} = chop_str
($title, 80, 5);
561 # remove leading stuff of merges to make the interesting part visible
562 if (length($title) > 50) {
563 $title =~ s/^Automatic //;
564 $title =~ s/^merge (of|with) /Merge ... /i;
565 if (length($title) > 50) {
566 $title =~ s/(http|rsync):\/\///;
568 if (length($title) > 50) {
569 $title =~ s/(master|www|rsync)\.//;
571 if (length($title) > 50) {
572 $title =~ s/kernel.org:?//;
574 if (length($title) > 50) {
575 $title =~ s/\/pub\/scm//;
578 $co{'title_short'} = chop_str
($title, 50, 5);
582 # remove added spaces
583 foreach my $line (@commit_lines) {
586 $co{'comment'} = \
@commit_lines;
588 my $age = time - $co{'committer_epoch'};
590 $co{'age_string'} = age_string
($age);
591 my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = gmtime($co{'committer_epoch'});
592 if ($age > 60*60*24*7*2) {
593 $co{'age_string_date'} = sprintf "%4i-%02u-%02i", 1900 + $year, $mon+1, $mday;
594 $co{'age_string_age'} = $co{'age_string'};
596 $co{'age_string_date'} = $co{'age_string'};
597 $co{'age_string_age'} = sprintf "%4i-%02u-%02i", 1900 + $year, $mon+1, $mday;
604 my $from_name = shift;
607 my $format = shift || "html";
609 my $from_tmp = "/dev/null";
610 my $to_tmp = "/dev/null";
613 # create tmp from-file
615 $from_tmp = "$git_temp/gitweb_" . $$ . "_from";
616 open my $fd2, "> $from_tmp";
617 open my $fd, "-|", "$gitbin/git-cat-file blob $from";
626 $to_tmp = "$git_temp/gitweb_" . $$ . "_to";
627 open my $fd2, "> $to_tmp";
628 open my $fd, "-|", "$gitbin/git-cat-file blob $to";
635 open my $fd, "-|", "/usr/bin/diff -u -p -L \'$from_name\' -L \'$to_name\' $from_tmp $to_tmp";
636 if ($format eq "plain") {
641 while (my $line = <$fd>) {
643 my $char = substr($line, 0, 1);
646 $color = " style=\"color:#008800;\"";
647 } elsif ($char eq "-") {
648 $color = " style=\"color:#cc0000;\"";
649 } elsif ($char eq "@") {
650 $color = " style=\"color:#990099;\"";
651 } elsif ($char eq "\\") {
655 while ((my $pos = index($line, "\t")) != -1) {
656 if (my $count = (8 - (($pos-1) % 8))) {
657 my $spaces = ' ' x
$count;
658 $line =~ s/\t/$spaces/;
661 print "<div class=\"pre\"$color>" . esc_html
($line) . "</div>\n";
675 my $mode = oct shift;
677 if (S_ISDIR
($mode & S_IFMT
)) {
679 } elsif (S_ISLNK
($mode)) {
681 } elsif (S_ISREG
($mode)) {
682 # git cares only about the executable bit
683 if ($mode & S_IXUSR
) {
696 my $add_len = shift || 10;
698 # allow only $len chars, but don't cut a word if it would fit in $add_len
699 # if it doesn't fit, cut it if it's still longer than the dots we would add
700 $str =~ m/^(.{0,$len}[^ \/\
-_
:\
.@
]{0,$add_len})(.*)/;
703 if (length($tail) > 4) {
710 my $mode = oct shift;
712 if (S_ISDIR
($mode & S_IFMT
)) {
714 } elsif (S_ISLNK
($mode)) {
716 } elsif (S_ISREG
($mode)) {
723 sub format_log_line_html
{
726 $line = esc_html
($line);
727 $line =~ s/ / /g;
728 if ($line =~ m/([0-9a-fA-F]{40})/) {
730 if (git_get_type
($hash_text) eq "commit") {
731 my $link = $cgi->a({-class => "text", -href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$hash_text")}, $hash_text);
732 $line =~ s/$hash_text/$link/;
740 my $tz = shift || "-0000";
743 my @months = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
744 my @days = ("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
745 my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = gmtime($epoch);
746 $date{'hour'} = $hour;
747 $date{'minute'} = $min;
748 $date{'mday'} = $mday;
749 $date{'day'} = $days[$wday];
750 $date{'month'} = $months[$mon];
751 $date{'rfc2822'} = sprintf "%s, %d %s %4d %02d:%02d:%02d +0000", $days[$wday], $mday, $months[$mon], 1900+$year, $hour ,$min, $sec;
752 $date{'mday-time'} = sprintf "%d %s %02d:%02d", $mday, $months[$mon], $hour ,$min;
754 $tz =~ m/^([+\-][0-9][0-9])([0-9][0-9])$/;
755 my $local = $epoch + ((int $1 + ($2/60)) * 3600);
756 ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = gmtime($local);
757 $date{'hour_local'} = $hour;
758 $date{'minute_local'} = $min;
759 $date{'tz_local'} = $tz;
763 # git-logo (cached in browser for one day)
765 binmode STDOUT
, ':raw';
766 print $cgi->header(-type
=> 'image/png', -expires
=> '+1d');
767 # cat git-logo.png | hexdump -e '16/1 " %02x" "\n"' | sed 's/ /\\x/g'
768 print "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52" .
769 "\x00\x00\x00\x48\x00\x00\x00\x1b\x04\x03\x00\x00\x00\x2d\xd9\xd4" .
770 "\x2d\x00\x00\x00\x18\x50\x4c\x54\x45\xff\xff\xff\x60\x60\x5d\xb0" .
771 "\xaf\xaa\x00\x80\x00\xce\xcd\xc7\xc0\x00\x00\xe8\xe8\xe6\xf7\xf7" .
772 "\xf6\x95\x0c\xa7\x47\x00\x00\x00\x73\x49\x44\x41\x54\x28\xcf\x63" .
773 "\x48\x67\x20\x04\x4a\x5c\x18\x0a\x08\x2a\x62\x53\x61\x20\x02\x08" .
774 "\x0d\x69\x45\xac\xa1\xa1\x01\x30\x0c\x93\x60\x36\x26\x52\x91\xb1" .
775 "\x01\x11\xd6\xe1\x55\x64\x6c\x6c\xcc\x6c\x6c\x0c\xa2\x0c\x70\x2a" .
776 "\x62\x06\x2a\xc1\x62\x1d\xb3\x01\x02\x53\xa4\x08\xe8\x00\x03\x18" .
777 "\x26\x56\x11\xd4\xe1\x20\x97\x1b\xe0\xb4\x0e\x35\x24\x71\x29\x82" .
778 "\x99\x30\xb8\x93\x0a\x11\xb9\x45\x88\xc1\x8d\xa0\xa2\x44\x21\x06" .
779 "\x27\x41\x82\x40\x85\xc1\x45\x89\x20\x70\x01\x00\xa4\x3d\x21\xc5" .
780 "\x12\x1c\x9a\xfe\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82";
786 my ($dev, $ino, $mode, $nlink, $st_uid, $st_gid, $rdev, $size) = stat($path);
787 my ($name, $passwd, $uid, $gid, $quota, $comment, $gcos, $dir, $shell) = getpwuid($st_uid);
788 if (!defined $gcos) {
792 $owner =~ s/[,;].*$//;
793 return decode
("utf8", $owner, Encode
::FB_DEFAULT
);
796 sub git_read_projects
{
799 if (-d
$projects_list) {
800 # search in directory
801 my $dir = $projects_list;
802 opendir my $dh, $dir or return undef;
803 while (my $dir = readdir($dh)) {
804 if (-e
"$projectroot/$dir/HEAD") {
812 } elsif (-f
$projects_list) {
813 # read from file(url-encoded):
814 # 'git%2Fgit.git Linus+Torvalds'
815 # 'libs%2Fklibc%2Fklibc.git H.+Peter+Anvin'
816 # 'linux%2Fhotplug%2Fudev.git Greg+Kroah-Hartman'
817 open my $fd , $projects_list or return undef;
818 while (my $line = <$fd>) {
820 my ($path, $owner) = split ' ', $line;
821 $path = unescape
($path);
822 $owner = unescape
($owner);
823 if (!defined $path) {
826 if (-e
"$projectroot/$path/HEAD") {
829 owner
=> decode
("utf8", $owner, Encode
::FB_DEFAULT
),
836 @list = sort {$a->{'path'} cmp $b->{'path'}} @list;
840 sub git_get_project_config
{
843 return unless ($key);
844 $key =~ s/^gitweb\.//;
845 return if ($key =~ m/\W/);
847 my $val = qx(git
-repo
-config
--get gitweb
.$key);
851 sub git_get_project_config_bool
{
852 my $val = git_get_project_config
(@_);
853 if ($val and $val =~ m/true|yes|on/) {
856 return; # implicit false
859 sub git_project_list
{
860 my @list = git_read_projects
();
863 die_error
(undef, "No project found.");
865 foreach my $pr (@list) {
866 my $head = git_read_head
($pr->{'path'});
867 if (!defined $head) {
870 $ENV{'GIT_DIR'} = "$projectroot/$pr->{'path'}";
871 my %co = git_read_commit
($head);
875 $pr->{'commit'} = \
%co;
876 if (!defined $pr->{'descr'}) {
877 my $descr = git_read_description
($pr->{'path'}) || "";
878 $pr->{'descr'} = chop_str
($descr, 25, 5);
880 if (!defined $pr->{'owner'}) {
881 $pr->{'owner'} = get_file_owner
("$projectroot/$pr->{'path'}") || "";
887 print "<div class=\"index_include\">\n";
888 open (my $fd, $home_text);
893 print "<table cellspacing=\"0\">\n" .
895 if (!defined($order) || (defined($order) && ($order eq "project"))) {
896 @projects = sort {$a->{'path'} cmp $b->{'path'}} @projects;
897 print "<th>Project</th>\n";
899 print "<th>" . $cgi->a({-class => "header", -href
=> "$my_uri?" . esc_param
("o=project")}, "Project") . "</th>\n";
901 if (defined($order) && ($order eq "descr")) {
902 @projects = sort {$a->{'descr'} cmp $b->{'descr'}} @projects;
903 print "<th>Description</th>\n";
905 print "<th>" . $cgi->a({-class => "header", -href
=> "$my_uri?" . esc_param
("o=descr")}, "Description") . "</th>\n";
907 if (defined($order) && ($order eq "owner")) {
908 @projects = sort {$a->{'owner'} cmp $b->{'owner'}} @projects;
909 print "<th>Owner</th>\n";
911 print "<th>" . $cgi->a({-class => "header", -href
=> "$my_uri?" . esc_param
("o=owner")}, "Owner") . "</th>\n";
913 if (defined($order) && ($order eq "age")) {
914 @projects = sort {$a->{'commit'}{'age'} <=> $b->{'commit'}{'age'}} @projects;
915 print "<th>Last Change</th>\n";
917 print "<th>" . $cgi->a({-class => "header", -href
=> "$my_uri?" . esc_param
("o=age")}, "Last Change") . "</th>\n";
919 print "<th></th>\n" .
922 foreach my $pr (@projects) {
924 print "<tr class=\"dark\">\n";
926 print "<tr class=\"light\">\n";
929 print "<td>" . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$pr->{'path'};a=summary"), -class => "list"}, esc_html
($pr->{'path'})) . "</td>\n" .
930 "<td>$pr->{'descr'}</td>\n" .
931 "<td><i>" . chop_str
($pr->{'owner'}, 15) . "</i></td>\n";
933 if ($pr->{'commit'}{'age'} < 60*60*2) {
934 $colored_age = "<span style =\"color: #009900;\"><b><i>$pr->{'commit'}{'age_string'}</i></b></span>";
935 } elsif ($pr->{'commit'}{'age'} < 60*60*24*2) {
936 $colored_age = "<span style =\"color: #009900;\"><i>$pr->{'commit'}{'age_string'}</i></span>";
938 $colored_age = "<i>$pr->{'commit'}{'age_string'}</i>";
940 print "<td>$colored_age</td>\n" .
941 "<td class=\"link\">" .
942 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$pr->{'path'};a=summary")}, "summary") .
943 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$pr->{'path'};a=shortlog")}, "shortlog") .
944 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$pr->{'path'};a=log")}, "log") .
953 my $type = shift || "";
955 # 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c refs/tags/v2.6.11
956 # c39ae07f393806ccf406ef966e9a15afc43cc36a refs/tags/v2.6.11^{}
957 open my $fd, "$projectroot/$project/info/refs" or return;
958 while (my $line = <$fd>) {
960 if ($line =~ m/^([0-9a-fA-F]{40})\t.*$type\/([^\
^]+)/) {
961 if (defined $refs{$1}) {
962 $refs{$1} .= " / $2";
977 opendir my $dh, "$projectroot/$project/$ref_dir";
978 while (my $dir = readdir($dh)) {
979 if ($dir =~ m/^\./) {
982 if (-d
"$projectroot/$project/$ref_dir/$dir") {
983 opendir my $dh2, "$projectroot/$project/$ref_dir/$dir";
984 my @subdirs = grep !m/^\./, readdir $dh2;
986 foreach my $subdir (@subdirs) {
987 push @refs, "$dir/$subdir"
994 foreach my $ref_file (@refs) {
995 my $ref_id = git_read_hash
("$project/$ref_dir/$ref_file");
996 my $type = git_get_type
($ref_id) || next;
999 $ref_item{'type'} = $type;
1000 $ref_item{'id'} = $ref_id;
1001 $ref_item{'epoch'} = 0;
1002 $ref_item{'age'} = "unknown";
1003 if ($type eq "tag") {
1004 my %tag = git_read_tag
($ref_id);
1005 $ref_item{'comment'} = $tag{'comment'};
1006 if ($tag{'type'} eq "commit") {
1007 %co = git_read_commit
($tag{'object'});
1008 $ref_item{'epoch'} = $co{'committer_epoch'};
1009 $ref_item{'age'} = $co{'age_string'};
1010 } elsif (defined($tag{'epoch'})) {
1011 my $age = time - $tag{'epoch'};
1012 $ref_item{'epoch'} = $tag{'epoch'};
1013 $ref_item{'age'} = age_string
($age);
1015 $ref_item{'reftype'} = $tag{'type'};
1016 $ref_item{'name'} = $tag{'name'};
1017 $ref_item{'refid'} = $tag{'object'};
1018 } elsif ($type eq "commit"){
1019 %co = git_read_commit
($ref_id);
1020 $ref_item{'reftype'} = "commit";
1021 $ref_item{'name'} = $ref_file;
1022 $ref_item{'title'} = $co{'title'};
1023 $ref_item{'refid'} = $ref_id;
1024 $ref_item{'epoch'} = $co{'committer_epoch'};
1025 $ref_item{'age'} = $co{'age_string'};
1028 push @reflist, \
%ref_item;
1031 @reflist = sort {$b->{'epoch'} <=> $a->{'epoch'}} @reflist;
1036 my $descr = git_read_description
($project) || "none";
1037 my $head = git_read_head
($project);
1038 my %co = git_read_commit
($head);
1039 my %cd = date_str
($co{'committer_epoch'}, $co{'committer_tz'});
1042 if (-f
$projects_list) {
1043 open (my $fd , $projects_list);
1044 while (my $line = <$fd>) {
1046 my ($pr, $ow) = split ' ', $line;
1047 $pr = unescape
($pr);
1048 $ow = unescape
($ow);
1049 if ($pr eq $project) {
1050 $owner = decode
("utf8", $ow, Encode
::FB_DEFAULT
);
1056 if (!defined $owner) {
1057 $owner = get_file_owner
("$projectroot/$project");
1060 my $refs = read_info_ref
();
1062 print "<div class=\"page_nav\">\n" .
1064 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=shortlog")}, "shortlog") .
1065 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=log")}, "log") .
1066 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$head")}, "commit") .
1067 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commitdiff;h=$head")}, "commitdiff") .
1068 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=tree")}, "tree") .
1071 print "<div class=\"title\"> </div>\n";
1072 print "<table cellspacing=\"0\">\n" .
1073 "<tr><td>description</td><td>" . esc_html
($descr) . "</td></tr>\n" .
1074 "<tr><td>owner</td><td>$owner</td></tr>\n" .
1075 "<tr><td>last change</td><td>$cd{'rfc2822'}</td></tr>\n" .
1077 open my $fd, "-|", "$gitbin/git-rev-list --max-count=17 " . git_read_head
($project) or die_error
(undef, "Open failed.");
1078 my (@revlist) = map { chomp; $_ } <$fd>;
1081 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=shortlog"), -class => "title"}, "shortlog") .
1084 print "<table cellspacing=\"0\">\n";
1086 foreach my $commit (@revlist) {
1087 my %co = git_read_commit
($commit);
1088 my %ad = date_str
($co{'author_epoch'});
1090 print "<tr class=\"dark\">\n";
1092 print "<tr class=\"light\">\n";
1097 if (defined $refs->{$commit}) {
1098 $ref = " <span class=\"tag\">" . esc_html
($refs->{$commit}) . "</span>";
1100 print "<td><i>$co{'age_string'}</i></td>\n" .
1101 "<td><i>" . esc_html
(chop_str
($co{'author_name'}, 10)) . "</i></td>\n" .
1103 if (length($co{'title_short'}) < length($co{'title'})) {
1104 print $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$commit"), -class => "list", -title
=> "$co{'title'}"},
1105 "<b>" . esc_html
($co{'title_short'}) . "$ref</b>");
1107 print $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$commit"), -class => "list"},
1108 "<b>" . esc_html
($co{'title'}) . "$ref</b>");
1111 "<td class=\"link\">" .
1112 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$commit")}, "commit") .
1113 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commitdiff;h=$commit")}, "commitdiff") .
1117 print "<td>" . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=shortlog")}, "...") . "</td>\n" .
1124 my $taglist = git_read_refs
("refs/tags");
1125 if (defined @
$taglist) {
1127 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=tags"), -class => "title"}, "tags") .
1130 print "<table cellspacing=\"0\">\n";
1132 foreach my $entry (@
$taglist) {
1134 my $comment_lines = $tag{'comment'};
1135 my $comment = shift @
$comment_lines;
1136 if (defined($comment)) {
1137 $comment = chop_str
($comment, 30, 5);
1140 print "<tr class=\"dark\">\n";
1142 print "<tr class=\"light\">\n";
1146 print "<td><i>$tag{'age'}</i></td>\n" .
1148 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=$tag{'reftype'};h=$tag{'refid'}"), -class => "list"},
1149 "<b>" . esc_html
($tag{'name'}) . "</b>") .
1152 if (defined($comment)) {
1153 print $cgi->a({-class => "list", -href
=> "$my_uri?" . esc_param
("p=$project;a=tag;h=$tag{'id'}")}, $comment);
1156 "<td class=\"link\">";
1157 if ($tag{'type'} eq "tag") {
1158 print $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=tag;h=$tag{'id'}")}, "tag") . " | ";
1160 print $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=$tag{'reftype'};h=$tag{'refid'}")}, $tag{'reftype'});
1161 if ($tag{'reftype'} eq "commit") {
1162 print " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=shortlog;h=$tag{'name'}")}, "shortlog") .
1163 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=log;h=$tag{'refid'}")}, "log");
1168 print "<td>" . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=tags")}, "...") . "</td>\n" .
1176 my $headlist = git_read_refs
("refs/heads");
1177 if (defined @
$headlist) {
1179 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=heads"), -class => "title"}, "heads") .
1182 print "<table cellspacing=\"0\">\n";
1184 foreach my $entry (@
$headlist) {
1187 print "<tr class=\"dark\">\n";
1189 print "<tr class=\"light\">\n";
1193 print "<td><i>$tag{'age'}</i></td>\n" .
1195 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=shortlog;h=$tag{'name'}"), -class => "list"},
1196 "<b>" . esc_html
($tag{'name'}) . "</b>") .
1198 "<td class=\"link\">" .
1199 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=shortlog;h=$tag{'name'}")}, "shortlog") .
1200 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=log;h=$tag{'name'}")}, "log") .
1204 print "<td>" . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=heads")}, "...") . "</td>\n" .
1215 my $head = git_read_head
($project);
1217 print "<div class=\"page_nav\">\n" .
1218 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=summary")}, "summary") .
1219 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=shortlog")}, "shortlog") .
1220 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=log")}, "log") .
1221 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$head")}, "commit") .
1222 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commitdiff;h=$head")}, "commitdiff") .
1223 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=tree;hb=$head")}, "tree") . "<br/>\n" .
1226 my %tag = git_read_tag
($hash);
1228 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$hash"), -class => "title"}, esc_html
($tag{'name'})) . "\n" .
1230 print "<div class=\"title_text\">\n" .
1231 "<table cellspacing=\"0\">\n" .
1233 "<td>object</td>\n" .
1234 "<td>" . $cgi->a({-class => "list", -href
=> "$my_uri?" . esc_param
("p=$project;a=$tag{'type'};h=$tag{'object'}")}, $tag{'object'}) . "</td>\n" .
1235 "<td class=\"link\">" . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=$tag{'type'};h=$tag{'object'}")}, $tag{'type'}) . "</td>\n" .
1237 if (defined($tag{'author'})) {
1238 my %ad = date_str
($tag{'epoch'}, $tag{'tz'});
1239 print "<tr><td>author</td><td>" . esc_html
($tag{'author'}) . "</td></tr>\n";
1240 print "<tr><td></td><td>" . $ad{'rfc2822'} . sprintf(" (%02d:%02d %s)", $ad{'hour_local'}, $ad{'minute_local'}, $ad{'tz_local'}) . "</td></tr>\n";
1242 print "</table>\n\n" .
1244 print "<div class=\"page_body\">";
1245 my $comment = $tag{'comment'};
1246 foreach my $line (@
$comment) {
1247 print esc_html
($line) . "<br/>\n";
1255 die_error
('403 Permission denied', "Permission denied.") if (!git_get_project_config_bool
('blame'));
1256 die_error
('404 Not Found', "What file will it be, master?") if (!$file_name);
1257 $hash_base ||= git_read_head
($project);
1258 die_error
(undef, "Reading commit failed.") unless ($hash_base);
1259 my %co = git_read_commit
($hash_base)
1260 or die_error
(undef, "Reading commit failed.");
1261 if (!defined $hash) {
1262 $hash = git_get_hash_by_path
($hash_base, $file_name, "blob")
1263 or die_error
(undef, "Error lookup file.");
1265 open ($fd, "-|", "$gitbin/git-annotate", '-l', '-t', '-r', $file_name, $hash_base)
1266 or die_error
(undef, "Open failed.");
1268 print "<div class=\"page_nav\">\n" .
1269 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=summary")}, "summary") .
1270 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=shortlog")}, "shortlog") .
1271 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=log")}, "log") .
1272 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$hash_base")}, "commit") .
1273 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commitdiff;h=$hash_base")}, "commitdiff") .
1274 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=tree;h=$co{'tree'};hb=$hash_base")}, "tree") . "<br/>\n";
1275 print $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blob;h=$hash;hb=$hash_base;f=$file_name")}, "blob") .
1276 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blame;f=$file_name")}, "head") . "<br/>\n";
1279 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html
($co{'title'})) .
1281 print "<div class=\"page_path\"><b>" . esc_html
($file_name) . "</b></div>\n";
1282 print "<div class=\"page_body\">\n";
1284 <table style="border-collapse: collapse;">
1293 my @line_class = (qw(light dark));
1294 my $line_class_len = scalar (@line_class);
1295 my $line_class_num = $#line_class;
1296 while (my $line = <$fd>) {
1308 $line_class_num = ($line_class_num + 1) % $line_class_len;
1310 if ($line =~ m/^([0-9a-fA-F]{40})\t\(\s*([^\t]+)\t(\d+) \+\d\d\d\d\t(\d+)\)(.*)$/) {
1317 print qq( <tr
><td colspan
="5" style
="color: red; background-color: yellow;">Unable to parse
: $line</td></tr
>\n);
1320 $short_rev = substr ($long_rev, 0, 8);
1321 $age = time () - $time;
1322 $age_str = age_string
($age);
1323 $age_str =~ s/ / /g;
1324 $age_style = 'font-style: italic;';
1325 $age_style .= ' color: #009900; background: transparent;' if ($age < 60*60*24*2);
1326 $age_style .= ' font-weight: bold;' if ($age < 60*60*2);
1327 $author = esc_html
($author);
1328 $author =~ s/ / /g;
1330 while ((my $pos = index($data, "\t")) != -1) {
1331 if (my $count = (8 - ($pos % 8))) {
1332 my $spaces = ' ' x
$count;
1333 $data =~ s/\t/$spaces/;
1336 $data = esc_html
($data);
1337 $data =~ s/ / /g;
1340 <tr class="$line_class[$line_class_num]">
1341 <td style="font-family: monospace;"><a href="$my_uri?${\esc_param ("p=$project;a=commit;h=$long_rev")}" class="text">$short_rev..</a></td>
1342 <td style="$age_style">$age_str</td>
1344 <td style="text-align: right;"><a id="$lineno" href="#$lineno" class="linenr">$lineno</a></td>
1345 <td style="font-family: monospace;">$data</td>
1348 } # while (my $line = <$fd>)
1349 print "</table>\n\n";
1350 close $fd or print "Reading blob failed.\n";
1356 my $head = git_read_head
($project);
1358 print "<div class=\"page_nav\">\n" .
1359 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=summary")}, "summary") .
1360 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=shortlog")}, "shortlog") .
1361 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=log")}, "log") .
1362 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$head")}, "commit") .
1363 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commitdiff;h=$head")}, "commitdiff") .
1364 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=tree;hb=$head")}, "tree") . "<br/>\n" .
1367 my $taglist = git_read_refs
("refs/tags");
1369 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=summary"), -class => "title"}, " ") .
1371 print "<table cellspacing=\"0\">\n";
1373 if (defined @
$taglist) {
1374 foreach my $entry (@
$taglist) {
1376 my $comment_lines = $tag{'comment'};
1377 my $comment = shift @
$comment_lines;
1378 if (defined($comment)) {
1379 $comment = chop_str
($comment, 30, 5);
1382 print "<tr class=\"dark\">\n";
1384 print "<tr class=\"light\">\n";
1387 print "<td><i>$tag{'age'}</i></td>\n" .
1389 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=$tag{'reftype'};h=$tag{'refid'}"), -class => "list"},
1390 "<b>" . esc_html
($tag{'name'}) . "</b>") .
1393 if (defined($comment)) {
1394 print $cgi->a({-class => "list", -href
=> "$my_uri?" . esc_param
("p=$project;a=tag;h=$tag{'id'}")}, $comment);
1397 "<td class=\"link\">";
1398 if ($tag{'type'} eq "tag") {
1399 print $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=tag;h=$tag{'id'}")}, "tag") . " | ";
1401 print $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=$tag{'reftype'};h=$tag{'refid'}")}, $tag{'reftype'});
1402 if ($tag{'reftype'} eq "commit") {
1403 print " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=shortlog;h=$tag{'name'}")}, "shortlog") .
1404 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=log;h=$tag{'refid'}")}, "log");
1415 my $head = git_read_head
($project);
1417 print "<div class=\"page_nav\">\n" .
1418 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=summary")}, "summary") .
1419 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=shortlog")}, "shortlog") .
1420 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=log")}, "log") .
1421 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$head")}, "commit") .
1422 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commitdiff;h=$head")}, "commitdiff") .
1423 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=tree;hb=$head")}, "tree") . "<br/>\n" .
1426 my $taglist = git_read_refs
("refs/heads");
1428 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=summary"), -class => "title"}, " ") .
1430 print "<table cellspacing=\"0\">\n";
1432 if (defined @
$taglist) {
1433 foreach my $entry (@
$taglist) {
1436 print "<tr class=\"dark\">\n";
1438 print "<tr class=\"light\">\n";
1441 print "<td><i>$tag{'age'}</i></td>\n" .
1443 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=shortlog;h=$tag{'name'}"), -class => "list"}, "<b>" . esc_html
($tag{'name'}) . "</b>") .
1445 "<td class=\"link\">" .
1446 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=shortlog;h=$tag{'name'}")}, "shortlog") .
1447 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=log;h=$tag{'name'}")}, "log") .
1456 sub git_get_hash_by_path
{
1458 my $path = shift || return undef;
1461 my @parts = split '/', $path;
1462 while (my $part = shift @parts) {
1463 open my $fd, "-|", "$gitbin/git-ls-tree $tree" or die_error
(undef, "Open git-ls-tree failed.");
1464 my (@entries) = map { chomp; $_ } <$fd>;
1465 close $fd or return undef;
1466 foreach my $line (@entries) {
1467 #'100644 blob 0fa3f3a66fb6a137f6ec2c19351ed4d807070ffa panic.c'
1468 $line =~ m/^([0-9]+) (.+) ([0-9a-fA-F]{40})\t(.+)$/;
1472 my $t_name = validate_input
(unquote
($4));
1473 if ($t_name eq $part) {
1477 if ($t_type eq "tree") {
1487 if (!defined $hash && defined $file_name) {
1488 my $base = $hash_base || git_read_head
($project);
1489 $hash = git_get_hash_by_path
($base, $file_name, "blob") || die_error
(undef, "Error lookup file.");
1491 my $have_blame = git_get_project_config_bool
('blame');
1492 open my $fd, "-|", "$gitbin/git-cat-file blob $hash" or die_error
(undef, "Open failed.");
1494 if (defined $hash_base && (my %co = git_read_commit
($hash_base))) {
1495 print "<div class=\"page_nav\">\n" .
1496 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=summary")}, "summary") .
1497 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=shortlog")}, "shortlog") .
1498 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=log")}, "log") .
1499 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$hash_base")}, "commit") .
1500 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commitdiff;h=$hash_base")}, "commitdiff") .
1501 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=tree;h=$co{'tree'};hb=$hash_base")}, "tree") . "<br/>\n";
1502 if (defined $file_name) {
1504 print $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blame;h=$hash;hb=$hash_base;f=$file_name")}, "blame") . " | ";
1506 print $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blob_plain;h=$hash;f=$file_name")}, "plain") .
1507 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blob;hb=HEAD;f=$file_name")}, "head") . "<br/>\n";
1509 print $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blob_plain;h=$hash")}, "plain") . "<br/>\n";
1513 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html
($co{'title'})) .
1516 print "<div class=\"page_nav\">\n" .
1517 "<br/><br/></div>\n" .
1518 "<div class=\"title\">$hash</div>\n";
1520 if (defined $file_name) {
1521 print "<div class=\"page_path\"><b>" . esc_html
($file_name) . "</b></div>\n";
1523 print "<div class=\"page_body\">\n";
1525 while (my $line = <$fd>) {
1528 while ((my $pos = index($line, "\t")) != -1) {
1529 if (my $count = (8 - ($pos % 8))) {
1530 my $spaces = ' ' x
$count;
1531 $line =~ s/\t/$spaces/;
1534 printf "<div class=\"pre\"><a id=\"l%i\" href=\"#l%i\" class=\"linenr\">%4i</a> %s</div>\n", $nr, $nr, $nr, esc_html
($line);
1536 close $fd or print "Reading blob failed.\n";
1541 sub git_blob_plain
{
1542 my $save_as = "$hash.txt";
1543 if (defined $file_name) {
1544 $save_as = $file_name;
1546 print $cgi->header(-type
=> "text/plain", -charset
=> 'utf-8', '-content-disposition' => "inline; filename=\"$save_as\"");
1547 open my $fd, "-|", "$gitbin/git-cat-file blob $hash" or return;
1555 if (!defined $hash) {
1556 $hash = git_read_head
($project);
1557 if (defined $file_name) {
1558 my $base = $hash_base || $hash;
1559 $hash = git_get_hash_by_path
($base, $file_name, "tree");
1561 if (!defined $hash_base) {
1566 open my $fd, "-|", "$gitbin/git-ls-tree -z $hash" or die_error
(undef, "Open git-ls-tree failed.");
1567 chomp (my (@entries) = <$fd>);
1568 close $fd or die_error
(undef, "Reading tree failed.");
1571 my $refs = read_info_ref
();
1573 if (defined $refs->{$hash_base}) {
1574 $ref = " <span class=\"tag\">" . esc_html
($refs->{$hash_base}) . "</span>";
1579 if (defined $hash_base && (my %co = git_read_commit
($hash_base))) {
1580 $base_key = ";hb=$hash_base";
1581 print "<div class=\"page_nav\">\n" .
1582 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=summary")}, "summary") .
1583 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=shortlog;h=$hash_base")}, "shortlog") .
1584 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=log;h=$hash_base")}, "log") .
1585 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$hash_base")}, "commit") .
1586 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commitdiff;h=$hash_base")}, "commitdiff") .
1591 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html
($co{'title'}) . $ref) . "\n" .
1594 print "<div class=\"page_nav\">\n";
1595 print "<br/><br/></div>\n";
1596 print "<div class=\"title\">$hash</div>\n";
1598 if (defined $file_name) {
1599 $base = esc_html
("$file_name/");
1600 print "<div class=\"page_path\"><b>/" . esc_html
($file_name) . "</b></div>\n";
1602 print "<div class=\"page_path\"><b>/</b></div>\n";
1604 print "<div class=\"page_body\">\n";
1605 print "<table cellspacing=\"0\">\n";
1607 foreach my $line (@entries) {
1608 #'100644 blob 0fa3f3a66fb6a137f6ec2c19351ed4d807070ffa panic.c'
1609 $line =~ m/^([0-9]+) (.+) ([0-9a-fA-F]{40})\t(.+)$/;
1613 my $t_name = validate_input
($4);
1615 print "<tr class=\"dark\">\n";
1617 print "<tr class=\"light\">\n";
1620 print "<td style=\"font-family:monospace\">" . mode_str
($t_mode) . "</td>\n";
1621 if ($t_type eq "blob") {
1622 print "<td class=\"list\">" .
1623 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blob;h=$t_hash$base_key;f=$base$t_name"), -class => "list"}, esc_html
($t_name)) .
1625 "<td class=\"link\">" .
1626 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blob;h=$t_hash$base_key;f=$base$t_name")}, "blob") .
1627 # " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;h=$t_hash$base_key;f=$base$t_name")}, "blame") .
1628 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=history;h=$hash_base;f=$base$t_name")}, "history") .
1630 } elsif ($t_type eq "tree") {
1631 print "<td class=\"list\">" .
1632 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=tree;h=$t_hash$base_key;f=$base$t_name")}, esc_html
($t_name)) .
1634 "<td class=\"link\">" .
1635 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=tree;h=$t_hash$base_key;f=$base$t_name")}, "tree") .
1640 print "</table>\n" .
1646 # http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ
1647 open my $fd, "-|", "$gitbin/git-rev-list --max-count=150 " . git_read_head
($project) or die_error
(undef, "Open failed.");
1648 my (@revlist) = map { chomp; $_ } <$fd>;
1649 close $fd or die_error
(undef, "Reading rev-list failed.");
1650 print $cgi->header(-type
=> 'text/xml', -charset
=> 'utf-8');
1651 print "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n".
1652 "<rss version=\"2.0\" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\">\n";
1653 print "<channel>\n";
1654 print "<title>$project</title>\n".
1655 "<link>" . esc_html
("$my_url?p=$project;a=summary") . "</link>\n".
1656 "<description>$project log</description>\n".
1657 "<language>en</language>\n";
1659 for (my $i = 0; $i <= $#revlist; $i++) {
1660 my $commit = $revlist[$i];
1661 my %co = git_read_commit
($commit);
1662 # we read 150, we always show 30 and the ones more recent than 48 hours
1663 if (($i >= 20) && ((time - $co{'committer_epoch'}) > 48*60*60)) {
1666 my %cd = date_str
($co{'committer_epoch'});
1667 open $fd, "-|", "$gitbin/git-diff-tree -r $co{'parent'} $co{'id'}" or next;
1668 my @difftree = map { chomp; $_ } <$fd>;
1672 sprintf("%d %s %02d:%02d", $cd{'mday'}, $cd{'month'}, $cd{'hour'}, $cd{'minute'}) . " - " . esc_html
($co{'title'}) .
1674 "<author>" . esc_html
($co{'author'}) . "</author>\n" .
1675 "<pubDate>$cd{'rfc2822'}</pubDate>\n" .
1676 "<guid isPermaLink=\"true\">" . esc_html
("$my_url?p=$project;a=commit;h=$commit") . "</guid>\n" .
1677 "<link>" . esc_html
("$my_url?p=$project;a=commit;h=$commit") . "</link>\n" .
1678 "<description>" . esc_html
($co{'title'}) . "</description>\n" .
1679 "<content:encoded>" .
1681 my $comment = $co{'comment'};
1682 foreach my $line (@
$comment) {
1683 $line = decode
("utf8", $line, Encode
::FB_DEFAULT
);
1684 print "$line<br/>\n";
1687 foreach my $line (@difftree) {
1688 if (!($line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)([0-9]{0,3})\t(.*)$/)) {
1691 my $file = validate_input
(unquote
($7));
1692 $file = decode
("utf8", $file, Encode
::FB_DEFAULT
);
1693 print "$file<br/>\n";
1696 "</content:encoded>\n" .
1699 print "</channel></rss>";
1703 my @list = git_read_projects
();
1705 print $cgi->header(-type
=> 'text/xml', -charset
=> 'utf-8');
1706 print "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n".
1707 "<opml version=\"1.0\">\n".
1709 " <title>Git OPML Export</title>\n".
1712 "<outline text=\"git RSS feeds\">\n";
1714 foreach my $pr (@list) {
1716 my $head = git_read_head
($proj{'path'});
1717 if (!defined $head) {
1720 $ENV{'GIT_DIR'} = "$projectroot/$proj{'path'}";
1721 my %co = git_read_commit
($head);
1726 my $path = esc_html
(chop_str
($proj{'path'}, 25, 5));
1727 my $rss = "$my_url?p=$proj{'path'};a=rss";
1728 my $html = "$my_url?p=$proj{'path'};a=summary";
1729 print "<outline type=\"rss\" text=\"$path\" title=\"$path\" xmlUrl=\"$rss\" htmlUrl=\"$html\"/>\n";
1731 print "</outline>\n".
1737 my $head = git_read_head
($project);
1738 if (!defined $hash) {
1741 if (!defined $page) {
1744 my $refs = read_info_ref
();
1746 print "<div class=\"page_nav\">\n";
1747 print $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=summary")}, "summary") .
1748 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=shortlog;h=$hash")}, "shortlog") .
1750 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$hash")}, "commit") .
1751 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commitdiff;h=$hash")}, "commitdiff") .
1752 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=tree;h=$hash;hb=$hash")}, "tree") . "<br/>\n";
1754 my $limit = sprintf("--max-count=%i", (100 * ($page+1)));
1755 open my $fd, "-|", "$gitbin/git-rev-list $limit $hash" or die_error
(undef, "Open failed.");
1756 my (@revlist) = map { chomp; $_ } <$fd>;
1759 if ($hash ne $head || $page) {
1760 print $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=log")}, "HEAD");
1766 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=log;h=$hash;pg=" . ($page-1)), -accesskey
=> "p", -title
=> "Alt-p"}, "prev");
1768 print " ⋅ prev";
1770 if ($#revlist >= (100 * ($page+1)-1)) {
1772 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=log;h=$hash;pg=" . ($page+1)), -accesskey
=> "n", -title
=> "Alt-n"}, "next");
1774 print " ⋅ next";
1780 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=summary"), -class => "title"}, " ") .
1782 my %co = git_read_commit
($hash);
1783 print "<div class=\"page_body\"> Last change $co{'age_string'}.<br/><br/></div>\n";
1785 for (my $i = ($page * 100); $i <= $#revlist; $i++) {
1786 my $commit = $revlist[$i];
1788 if (defined $refs->{$commit}) {
1789 $ref = " <span class=\"tag\">" . esc_html
($refs->{$commit}) . "</span>";
1791 my %co = git_read_commit
($commit);
1793 my %ad = date_str
($co{'author_epoch'});
1795 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$commit"), -class => "title"},
1796 "<span class=\"age\">$co{'age_string'}</span>" . esc_html
($co{'title'}) . $ref) . "\n";
1798 print "<div class=\"title_text\">\n" .
1799 "<div class=\"log_link\">\n" .
1800 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$commit")}, "commit") .
1801 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commitdiff;h=$commit")}, "commitdiff") .
1804 "<i>" . esc_html
($co{'author_name'}) . " [$ad{'rfc2822'}]</i><br/>\n" .
1806 "<div class=\"log_body\">\n";
1807 my $comment = $co{'comment'};
1809 foreach my $line (@
$comment) {
1810 if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
1821 print format_log_line_html
($line) . "<br/>\n";
1832 my %co = git_read_commit
($hash);
1834 die_error
(undef, "Unknown commit object.");
1836 my %ad = date_str
($co{'author_epoch'}, $co{'author_tz'});
1837 my %cd = date_str
($co{'committer_epoch'}, $co{'committer_tz'});
1841 my $parent = $co{'parent'};
1842 if (!defined $parent) {
1846 open my $fd, "-|", "$gitbin/git-diff-tree -r -M $root $parent $hash" or die_error
(undef, "Open failed.");
1847 @difftree = map { chomp; $_ } <$fd>;
1848 close $fd or die_error
(undef, "Reading diff-tree failed.");
1850 # non-textual hash id's can be cached
1852 if ($hash =~ m/^[0-9a-fA-F]{40}$/) {
1855 my $refs = read_info_ref
();
1857 if (defined $refs->{$co{'id'}}) {
1858 $ref = " <span class=\"tag\">" . esc_html
($refs->{$co{'id'}}) . "</span>";
1860 git_header_html
(undef, $expires);
1861 print "<div class=\"page_nav\">\n" .
1862 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=summary")}, "summary") .
1863 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=shortlog;h=$hash")}, "shortlog") .
1864 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=log;h=$hash")}, "log") .
1866 if (defined $co{'parent'}) {
1867 print " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commitdiff;h=$hash")}, "commitdiff");
1869 print " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=tree;h=$co{'tree'};hb=$hash")}, "tree") . "\n" .
1870 "<br/><br/></div>\n";
1871 if (defined $co{'parent'}) {
1873 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commitdiff;h=$hash"), -class => "title"}, esc_html
($co{'title'}) . $ref) . "\n" .
1877 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=tree;h=$co{'tree'};hb=$hash"), -class => "title"}, esc_html
($co{'title'})) . "\n" .
1880 print "<div class=\"title_text\">\n" .
1881 "<table cellspacing=\"0\">\n";
1882 print "<tr><td>author</td><td>" . esc_html
($co{'author'}) . "</td></tr>\n".
1884 "<td></td><td> $ad{'rfc2822'}";
1885 if ($ad{'hour_local'} < 6) {
1886 printf(" (<span style=\"color: #cc0000;\">%02d:%02d</span> %s)", $ad{'hour_local'}, $ad{'minute_local'}, $ad{'tz_local'});
1888 printf(" (%02d:%02d %s)", $ad{'hour_local'}, $ad{'minute_local'}, $ad{'tz_local'});
1892 print "<tr><td>committer</td><td>" . esc_html
($co{'committer'}) . "</td></tr>\n";
1893 print "<tr><td></td><td> $cd{'rfc2822'}" . sprintf(" (%02d:%02d %s)", $cd{'hour_local'}, $cd{'minute_local'}, $cd{'tz_local'}) . "</td></tr>\n";
1894 print "<tr><td>commit</td><td style=\"font-family:monospace\">$co{'id'}</td></tr>\n";
1897 "<td style=\"font-family:monospace\">" .
1898 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=tree;h=$co{'tree'};hb=$hash"), class => "list"}, $co{'tree'}) .
1900 "<td class=\"link\">" . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=tree;h=$co{'tree'};hb=$hash")}, "tree") .
1903 my $parents = $co{'parents'};
1904 foreach my $par (@
$parents) {
1907 "<td style=\"font-family:monospace\">" . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$par"), class => "list"}, $par) . "</td>" .
1908 "<td class=\"link\">" .
1909 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$par")}, "commit") .
1910 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commitdiff;h=$hash;hp=$par")}, "commitdiff") .
1916 print "<div class=\"page_body\">\n";
1917 my $comment = $co{'comment'};
1920 foreach my $line (@
$comment) {
1921 # print only one empty line
1923 if ($empty || $signed) {
1930 if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
1932 print "<span style=\"color: #888888\">" . esc_html
($line) . "</span><br/>\n";
1935 print format_log_line_html
($line) . "<br/>\n";
1939 print "<div class=\"list_head\">\n";
1940 if ($#difftree > 10) {
1941 print(($#difftree + 1) . " files changed:\n");
1944 print "<table cellspacing=\"0\">\n";
1946 foreach my $line (@difftree) {
1947 # ':100644 100644 03b218260e99b78c6df0ed378e59ed9205ccc96d 3b93d5e7cc7f7dd4ebed13a5cc1a4ad976fc94d8 M ls-files.c'
1948 # ':100644 100644 7f9281985086971d3877aca27704f2aaf9c448ce bc190ebc71bbd923f2b728e505408f5e54bd073a M rev-tree.c'
1949 if (!($line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)([0-9]{0,3})\t(.*)$/)) {
1957 my $similarity = $6;
1958 my $file = validate_input
(unquote
($7));
1960 print "<tr class=\"dark\">\n";
1962 print "<tr class=\"light\">\n";
1965 if ($status eq "A") {
1967 if (S_ISREG
(oct $to_mode)) {
1968 $mode_chng = sprintf(" with mode: %04o", (oct $to_mode) & 0777);
1971 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blob;h=$to_id;hb=$hash;f=$file"), -class => "list"}, esc_html
($file)) . "</td>\n" .
1972 "<td><span style=\"color: #008000;\">[new " . file_type
($to_mode) . "$mode_chng]</span></td>\n" .
1973 "<td class=\"link\">" . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blob;h=$to_id;hb=$hash;f=$file")}, "blob") . "</td>\n";
1974 } elsif ($status eq "D") {
1976 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blob;h=$from_id;hb=$hash;f=$file"), -class => "list"}, esc_html
($file)) . "</td>\n" .
1977 "<td><span style=\"color: #c00000;\">[deleted " . file_type
($from_mode). "]</span></td>\n" .
1978 "<td class=\"link\">" .
1979 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blob;h=$from_id;hb=$hash;f=$file")}, "blob") .
1980 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=history;h=$hash;f=$file")}, "history") .
1982 } elsif ($status eq "M" || $status eq "T") {
1983 my $mode_chnge = "";
1984 if ($from_mode != $to_mode) {
1985 $mode_chnge = " <span style=\"color: #777777;\">[changed";
1986 if (((oct $from_mode) & S_IFMT
) != ((oct $to_mode) & S_IFMT
)) {
1987 $mode_chnge .= " from " . file_type
($from_mode) . " to " . file_type
($to_mode);
1989 if (((oct $from_mode) & 0777) != ((oct $to_mode) & 0777)) {
1990 if (S_ISREG
($from_mode) && S_ISREG
($to_mode)) {
1991 $mode_chnge .= sprintf(" mode: %04o->%04o", (oct $from_mode) & 0777, (oct $to_mode) & 0777);
1992 } elsif (S_ISREG
($to_mode)) {
1993 $mode_chnge .= sprintf(" mode: %04o", (oct $to_mode) & 0777);
1996 $mode_chnge .= "]</span>\n";
1999 if ($to_id ne $from_id) {
2000 print $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$file"), -class => "list"}, esc_html
($file));
2002 print $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blob;h=$to_id;hb=$hash;f=$file"), -class => "list"}, esc_html
($file));
2005 "<td>$mode_chnge</td>\n" .
2006 "<td class=\"link\">";
2007 print $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blob;h=$to_id;hb=$hash;f=$file")}, "blob");
2008 if ($to_id ne $from_id) {
2009 print " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$file")}, "diff");
2011 print " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=history;h=$hash;f=$file")}, "history") . "\n";
2013 } elsif ($status eq "R") {
2014 my ($from_file, $to_file) = split "\t", $file;
2016 if ($from_mode != $to_mode) {
2017 $mode_chng = sprintf(", mode: %04o", (oct $to_mode) & 0777);
2020 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blob;h=$to_id;hb=$hash;f=$to_file"), -class => "list"}, esc_html
($to_file)) . "</td>\n" .
2021 "<td><span style=\"color: #777777;\">[moved from " .
2022 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blob;h=$from_id;hb=$hash;f=$from_file"), -class => "list"}, esc_html
($from_file)) .
2023 " with " . (int $similarity) . "% similarity$mode_chng]</span></td>\n" .
2024 "<td class=\"link\">" .
2025 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blob;h=$to_id;hb=$hash;f=$to_file")}, "blob");
2026 if ($to_id ne $from_id) {
2027 print " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$to_file")}, "diff");
2038 mkdir($git_temp, 0700);
2040 if (defined $hash_base && (my %co = git_read_commit
($hash_base))) {
2041 print "<div class=\"page_nav\">\n" .
2042 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=summary")}, "summary") .
2043 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=shortlog")}, "shortlog") .
2044 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=log")}, "log") .
2045 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$hash_base")}, "commit") .
2046 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commitdiff;h=$hash_base")}, "commitdiff") .
2047 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=tree;h=$co{'tree'};hb=$hash_base")}, "tree") .
2049 print $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blobdiff_plain;h=$hash;hp=$hash_parent")}, "plain") .
2052 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html
($co{'title'})) . "\n" .
2055 print "<div class=\"page_nav\">\n" .
2056 "<br/><br/></div>\n" .
2057 "<div class=\"title\">$hash vs $hash_parent</div>\n";
2059 if (defined $file_name) {
2060 print "<div class=\"page_path\"><b>/" . esc_html
($file_name) . "</b></div>\n";
2062 print "<div class=\"page_body\">\n" .
2063 "<div class=\"diff_info\">blob:" .
2064 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blob;h=$hash_parent;hb=$hash_base;f=$file_name")}, $hash_parent) .
2066 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blob;h=$hash;hb=$hash_base;f=$file_name")}, $hash) .
2068 git_diff_print
($hash_parent, $file_name || $hash_parent, $hash, $file_name || $hash);
2073 sub git_blobdiff_plain
{
2074 mkdir($git_temp, 0700);
2075 print $cgi->header(-type
=> "text/plain", -charset
=> 'utf-8');
2076 git_diff_print
($hash_parent, $file_name || $hash_parent, $hash, $file_name || $hash, "plain");
2079 sub git_commitdiff
{
2080 mkdir($git_temp, 0700);
2081 my %co = git_read_commit
($hash);
2083 die_error
(undef, "Unknown commit object.");
2085 if (!defined $hash_parent) {
2086 $hash_parent = $co{'parent'};
2088 open my $fd, "-|", "$gitbin/git-diff-tree -r $hash_parent $hash" or die_error
(undef, "Open failed.");
2089 my (@difftree) = map { chomp; $_ } <$fd>;
2090 close $fd or die_error
(undef, "Reading diff-tree failed.");
2092 # non-textual hash id's can be cached
2094 if ($hash =~ m/^[0-9a-fA-F]{40}$/) {
2097 my $refs = read_info_ref
();
2099 if (defined $refs->{$co{'id'}}) {
2100 $ref = " <span class=\"tag\">" . esc_html
($refs->{$co{'id'}}) . "</span>";
2102 git_header_html
(undef, $expires);
2103 print "<div class=\"page_nav\">\n" .
2104 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=summary")}, "summary") .
2105 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=shortlog;h=$hash")}, "shortlog") .
2106 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=log;h=$hash")}, "log") .
2107 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$hash")}, "commit") .
2109 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=tree;h=$co{'tree'};hb=$hash")}, "tree") . "<br/>\n";
2110 print $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commitdiff_plain;h=$hash;hp=$hash_parent")}, "plain") . "\n" .
2113 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$hash"), -class => "title"}, esc_html
($co{'title'}) . $ref) . "\n" .
2115 print "<div class=\"page_body\">\n";
2116 my $comment = $co{'comment'};
2119 my @log = @
$comment;
2120 # remove first and empty lines after that
2122 while (defined $log[0] && $log[0] eq "") {
2125 foreach my $line (@log) {
2126 if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
2137 print format_log_line_html
($line) . "<br/>\n";
2140 foreach my $line (@difftree) {
2141 # ':100644 100644 03b218260e99b78c6df0ed378e59ed9205ccc96d 3b93d5e7cc7f7dd4ebed13a5cc1a4ad976fc94d8 M ls-files.c'
2142 # ':100644 100644 7f9281985086971d3877aca27704f2aaf9c448ce bc190ebc71bbd923f2b728e505408f5e54bd073a M rev-tree.c'
2143 $line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)\t(.*)$/;
2149 my $file = validate_input
(unquote
($6));
2150 if ($status eq "A") {
2151 print "<div class=\"diff_info\">" . file_type
($to_mode) . ":" .
2152 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blob;h=$to_id;hb=$hash;f=$file")}, $to_id) . "(new)" .
2154 git_diff_print
(undef, "/dev/null", $to_id, "b/$file");
2155 } elsif ($status eq "D") {
2156 print "<div class=\"diff_info\">" . file_type
($from_mode) . ":" .
2157 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blob;h=$from_id;hb=$hash;f=$file")}, $from_id) . "(deleted)" .
2159 git_diff_print
($from_id, "a/$file", undef, "/dev/null");
2160 } elsif ($status eq "M") {
2161 if ($from_id ne $to_id) {
2162 print "<div class=\"diff_info\">" .
2163 file_type
($from_mode) . ":" . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blob;h=$from_id;hb=$hash;f=$file")}, $from_id) .
2165 file_type
($to_mode) . ":" . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blob;h=$to_id;hb=$hash;f=$file")}, $to_id);
2167 git_diff_print
($from_id, "a/$file", $to_id, "b/$file");
2176 sub git_commitdiff_plain
{
2177 mkdir($git_temp, 0700);
2178 open my $fd, "-|", "$gitbin/git-diff-tree -r $hash_parent $hash" or die_error
(undef, "Open failed.");
2179 my (@difftree) = map { chomp; $_ } <$fd>;
2180 close $fd or die_error
(undef, "Reading diff-tree failed.");
2182 # try to figure out the next tag after this commit
2184 my $refs = read_info_ref
("tags");
2185 open $fd, "-|", "$gitbin/git-rev-list HEAD";
2186 chomp (my (@commits) = <$fd>);
2188 foreach my $commit (@commits) {
2189 if (defined $refs->{$commit}) {
2190 $tagname = $refs->{$commit}
2192 if ($commit eq $hash) {
2197 print $cgi->header(-type
=> "text/plain", -charset
=> 'utf-8', '-content-disposition' => "inline; filename=\"git-$hash.patch\"");
2198 my %co = git_read_commit
($hash);
2199 my %ad = date_str
($co{'author_epoch'}, $co{'author_tz'});
2200 my $comment = $co{'comment'};
2201 print "From: $co{'author'}\n" .
2202 "Date: $ad{'rfc2822'} ($ad{'tz_local'})\n".
2203 "Subject: $co{'title'}\n";
2204 if (defined $tagname) {
2205 print "X-Git-Tag: $tagname\n";
2207 print "X-Git-Url: $my_url?p=$project;a=commitdiff;h=$hash\n" .
2210 foreach my $line (@
$comment) {;
2215 foreach my $line (@difftree) {
2216 $line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)\t(.*)$/;
2221 if ($status eq "A") {
2222 git_diff_print
(undef, "/dev/null", $to_id, "b/$file", "plain");
2223 } elsif ($status eq "D") {
2224 git_diff_print
($from_id, "a/$file", undef, "/dev/null", "plain");
2225 } elsif ($status eq "M") {
2226 git_diff_print
($from_id, "a/$file", $to_id, "b/$file", "plain");
2232 if (!defined $hash) {
2233 $hash = git_read_head
($project);
2235 my %co = git_read_commit
($hash);
2237 die_error
(undef, "Unknown commit object.");
2239 my $refs = read_info_ref
();
2241 print "<div class=\"page_nav\">\n" .
2242 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=summary")}, "summary") .
2243 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=shortlog")}, "shortlog") .
2244 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=log")}, "log") .
2245 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$hash")}, "commit") .
2246 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commitdiff;h=$hash")}, "commitdiff") .
2247 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=tree;h=$co{'tree'};hb=$hash")}, "tree") .
2251 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$hash"), -class => "title"}, esc_html
($co{'title'})) . "\n" .
2253 print "<div class=\"page_path\"><b>/" . esc_html
($file_name) . "</b><br/></div>\n";
2255 open my $fd, "-|", "$gitbin/git-rev-list $hash | $gitbin/git-diff-tree -r --stdin -- \'$file_name\'";
2257 print "<table cellspacing=\"0\">\n";
2259 while (my $line = <$fd>) {
2260 if ($line =~ m/^([0-9a-fA-F]{40})/){
2264 if ($line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)\t(.*)$/ && (defined $commit)) {
2265 my %co = git_read_commit
($commit);
2270 if (defined $refs->{$commit}) {
2271 $ref = " <span class=\"tag\">" . esc_html
($refs->{$commit}) . "</span>";
2274 print "<tr class=\"dark\">\n";
2276 print "<tr class=\"light\">\n";
2279 print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
2280 "<td><i>" . esc_html
(chop_str
($co{'author_name'}, 15, 3)) . "</i></td>\n" .
2281 "<td>" . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$commit"), -class => "list"}, "<b>" .
2282 esc_html
(chop_str
($co{'title'}, 50)) . "$ref</b>") . "</td>\n" .
2283 "<td class=\"link\">" .
2284 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$commit")}, "commit") .
2285 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commitdiff;h=$commit")}, "commitdiff") .
2286 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blob;hb=$commit;f=$file_name")}, "blob");
2287 my $blob = git_get_hash_by_path
($hash, $file_name);
2288 my $blob_parent = git_get_hash_by_path
($commit, $file_name);
2289 if (defined $blob && defined $blob_parent && $blob ne $blob_parent) {
2291 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blobdiff;h=$blob;hp=$blob_parent;hb=$commit;f=$file_name")},
2305 if (!defined $searchtext) {
2306 die_error
("", "Text field empty.");
2308 if (!defined $hash) {
2309 $hash = git_read_head
($project);
2311 my %co = git_read_commit
($hash);
2313 die_error
(undef, "Unknown commit object.");
2315 # pickaxe may take all resources of your box and run for several minutes
2316 # with every query - so decide by yourself how public you make this feature :)
2317 my $commit_search = 1;
2318 my $author_search = 0;
2319 my $committer_search = 0;
2320 my $pickaxe_search = 0;
2321 if ($searchtext =~ s/^author\\://i) {
2323 } elsif ($searchtext =~ s/^committer\\://i) {
2324 $committer_search = 1;
2325 } elsif ($searchtext =~ s/^pickaxe\\://i) {
2327 $pickaxe_search = 1;
2330 print "<div class=\"page_nav\">\n" .
2331 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=summary;h=$hash")}, "summary") .
2332 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=shortlog")}, "shortlog") .
2333 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=log;h=$hash")}, "log") .
2334 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$hash")}, "commit") .
2335 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commitdiff;h=$hash")}, "commitdiff") .
2336 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=tree;h=$co{'tree'};hb=$hash")}, "tree") .
2341 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$hash"), -class => "title"}, esc_html
($co{'title'})) . "\n" .
2343 print "<table cellspacing=\"0\">\n";
2345 if ($commit_search) {
2347 open my $fd, "-|", "$gitbin/git-rev-list --header --parents $hash" or next;
2348 while (my $commit_text = <$fd>) {
2349 if (!grep m/$searchtext/i, $commit_text) {
2352 if ($author_search && !grep m/\nauthor .*$searchtext/i, $commit_text) {
2355 if ($committer_search && !grep m/\ncommitter .*$searchtext/i, $commit_text) {
2358 my @commit_lines = split "\n", $commit_text;
2359 my %co = git_read_commit
(undef, \
@commit_lines);
2364 print "<tr class=\"dark\">\n";
2366 print "<tr class=\"light\">\n";
2369 print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
2370 "<td><i>" . esc_html
(chop_str
($co{'author_name'}, 15, 5)) . "</i></td>\n" .
2372 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$co{'id'}"), -class => "list"}, "<b>" . esc_html
(chop_str
($co{'title'}, 50)) . "</b><br/>");
2373 my $comment = $co{'comment'};
2374 foreach my $line (@
$comment) {
2375 if ($line =~ m/^(.*)($searchtext)(.*)$/i) {
2376 my $lead = esc_html
($1) || "";
2377 $lead = chop_str
($lead, 30, 10);
2378 my $match = esc_html
($2) || "";
2379 my $trail = esc_html
($3) || "";
2380 $trail = chop_str
($trail, 30, 10);
2381 my $text = "$lead<span style=\"color:#e00000\">$match</span>$trail";
2382 print chop_str
($text, 80, 5) . "<br/>\n";
2386 "<td class=\"link\">" .
2387 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$co{'id'}")}, "commit") .
2388 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=tree;h=$co{'tree'};hb=$co{'id'}")}, "tree");
2395 if ($pickaxe_search) {
2397 open my $fd, "-|", "$gitbin/git-rev-list $hash | $gitbin/git-diff-tree -r --stdin -S\'$searchtext\'";
2400 while (my $line = <$fd>) {
2401 if (%co && $line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)\t(.*)$/) {
2404 $set{'from_id'} = $3;
2406 $set{'id'} = $set{'to_id'};
2407 if ($set{'id'} =~ m/0{40}/) {
2408 $set{'id'} = $set{'from_id'};
2410 if ($set{'id'} =~ m/0{40}/) {
2414 } elsif ($line =~ m/^([0-9a-fA-F]{40})$/){
2417 print "<tr class=\"dark\">\n";
2419 print "<tr class=\"light\">\n";
2422 print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
2423 "<td><i>" . esc_html
(chop_str
($co{'author_name'}, 15, 5)) . "</i></td>\n" .
2425 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$co{'id'}"), -class => "list"}, "<b>" .
2426 esc_html
(chop_str
($co{'title'}, 50)) . "</b><br/>");
2427 while (my $setref = shift @files) {
2429 print $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=blob;h=$set{'id'};hb=$co{'id'};f=$set{'file'}"), class => "list"},
2430 "<span style=\"color:#e00000\">" . esc_html
($set{'file'}) . "</span>") .
2434 "<td class=\"link\">" .
2435 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$co{'id'}")}, "commit") .
2436 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=tree;h=$co{'tree'};hb=$co{'id'}")}, "tree");
2440 %co = git_read_commit
($1);
2450 my $head = git_read_head
($project);
2451 if (!defined $hash) {
2454 if (!defined $page) {
2457 my $refs = read_info_ref
();
2459 print "<div class=\"page_nav\">\n" .
2460 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=summary")}, "summary") .
2462 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=log;h=$hash")}, "log") .
2463 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$hash")}, "commit") .
2464 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commitdiff;h=$hash")}, "commitdiff") .
2465 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=tree;h=$hash;hb=$hash")}, "tree") . "<br/>\n";
2467 my $limit = sprintf("--max-count=%i", (100 * ($page+1)));
2468 open my $fd, "-|", "$gitbin/git-rev-list $limit $hash" or die_error
(undef, "Open failed.");
2469 my (@revlist) = map { chomp; $_ } <$fd>;
2472 if ($hash ne $head || $page) {
2473 print $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=shortlog")}, "HEAD");
2479 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=shortlog;h=$hash;pg=" . ($page-1)), -accesskey
=> "p", -title
=> "Alt-p"}, "prev");
2481 print " ⋅ prev";
2483 if ($#revlist >= (100 * ($page+1)-1)) {
2485 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=shortlog;h=$hash;pg=" . ($page+1)), -accesskey
=> "n", -title
=> "Alt-n"}, "next");
2487 print " ⋅ next";
2492 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=summary"), -class => "title"}, " ") .
2494 print "<table cellspacing=\"0\">\n";
2496 for (my $i = ($page * 100); $i <= $#revlist; $i++) {
2497 my $commit = $revlist[$i];
2499 if (defined $refs->{$commit}) {
2500 $ref = " <span class=\"tag\">" . esc_html
($refs->{$commit}) . "</span>";
2502 my %co = git_read_commit
($commit);
2503 my %ad = date_str
($co{'author_epoch'});
2505 print "<tr class=\"dark\">\n";
2507 print "<tr class=\"light\">\n";
2510 print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
2511 "<td><i>" . esc_html
(chop_str
($co{'author_name'}, 10)) . "</i></td>\n" .
2513 if (length($co{'title_short'}) < length($co{'title'})) {
2514 print $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$commit"), -class => "list", -title
=> "$co{'title'}"},
2515 "<b>" . esc_html
($co{'title_short'}) . "$ref</b>");
2517 print $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$commit"), -class => "list"},
2518 "<b>" . esc_html
($co{'title_short'}) . "$ref</b>");
2521 "<td class=\"link\">" .
2522 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commit;h=$commit")}, "commit") .
2523 " | " . $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=commitdiff;h=$commit")}, "commitdiff") .
2527 if ($#revlist >= (100 * ($page+1)-1)) {
2530 $cgi->a({-href
=> "$my_uri?" . esc_param
("p=$project;a=shortlog;h=$hash;pg=" . ($page+1)), -title
=> "Alt-n"}, "next") .