]>
Lady’s Gitweb - Gitweb/blob - gitweb.cgi
8e7ee63e9b324fb584baa0f63083fcfbdeccb8143e62612cd11da8d296d3880f
3 # gitweb.pl - 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 file is licensed under the GPL v2, or a later version
12 use CGI
qw(:standard :escapeHTML);
13 use CGI
::Carp
qw(fatalsToBrowser);
18 my $projectroot = "/pub/scm";
19 my $home_link = "/git";
20 my $gitbin = "/usr/bin";
21 my $gittmp = "/tmp/gitweb";
22 my $logo_link = "/pub/software/scm/cogito";
23 my $my_url = $cgi->url();
24 my $my_uri = $cgi->url(-absolute
=> 1);
27 my $projectroot = "/home/kay/public_html/pub/scm";
28 my $home_link = "/~kay/git";
29 my $logo_link = "/~kay/pub/software/scm/cogito";
33 my $project = $cgi->param('p');
34 my $action = $cgi->param('a');
35 my $hash = $cgi->param('h');
36 my $hash_parent = $cgi->param('hp');
37 my $file_name = $cgi->param('f');
38 my $time_back = $cgi->param('t');
39 $ENV{'SHA1_FILE_DIRECTORY'} = "$projectroot/$project/objects";
42 if (defined($project)) {
43 if ($project =~ /(^|\/)(|\
.|\
.\
.)($|\
/)/) {
44 die_error
("", "Invalid project parameter.");
46 if (!(-d
"$projectroot/$project")) {
47 die_error
("", "No such project.");
50 if (defined($file_name) && $file_name =~ /(^|\/)(|\
.|\
.\
.)($|\
/)/) {
51 die_error
("", "Invalid file parameter.");
53 if (defined($action) && !$action =~ m/^[0-9a-zA-Z\.\-]+$/) {
54 die_error
("", "Invalid action parameter.");
56 if (defined($hash) && !($hash =~ m/^[0-9a-fA-F]{40}$/)) {
57 die_error
("", "Invalid hash parameter.");
59 if (defined($hash_parent) && !($hash_parent =~ m/^[0-9a-fA-F]{40}$/)) {
60 die_error
("", "Invalid parent hash parameter.");
62 if (defined($time_back) && !($time_back =~ m/^[0-9]+$/)) {
63 die_error
("", "Invalid time parameter.");
67 my $status = shift || "200 OK";
69 print $cgi->header(-type
=>'text/html', -charset
=> 'utf-8', -status
=> $status);
71 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
74 <title>git - $project $action</title>
75 <link rel="alternate" title="$project log" href="$my_uri?p=$project;a=rss" type="application/rss+xml"/>
76 <style type="text/css">
77 body { font-family: sans-serif; font-size: 12px; margin:0px; }
79 a:hover { color:#880000; }
80 a:visited { color:#880000; }
81 a:active { color:#880000; }
83 margin:15px 25px 0px; height:25px; padding:8px;
84 font-size:18px; clear:both; font-weight:bold; background-color: #d9d8d1;
86 div.page_header a:visited { color:#0000cc; }
87 div.page_nav { margin:0px 25px; padding:8px; clear:both; border:solid #d9d8d1; border-width:0px 1px; }
88 div.page_nav a:visited { color:#0000cc; }
90 margin:0px 25px 15px; height:17px; padding:4px; padding-left:8px;
91 clear:both; background-color: #d9d8d1;
93 div.page_footer_text { float:left; color:#888888; font-size:10px;}
94 div.page_body { margin:0px 25px; padding:8px; clear:both; border:solid #d9d8d1; border-width:0px 1px; }
96 display:block; margin:0px 25px; padding:8px; clear:both;
97 font-weight:bold; background-color: #d9d8d1; color:#000000;
100 display:block; margin:0px 25px; padding:6px; clear:both;
101 font-weight:bold; background-color: #d9d8d1; text-decoration:none; color:#000000;
103 a.log_title:hover { background-color: #c9c8c1; }
105 margin:0px 25px; padding:8px; clear:both;
106 border: solid #d9d8d1; border-width:0px 1px; font-family:monospace;
107 background-color: #edece6;
110 margin:0px 25px; padding:8px; padding-left:150px; clear:both;
111 border:solid #d9d8d1; border-width:0px 1px;
113 span.log_age { position:relative; float:left; width:142px; }
114 div.log_link { font-size:10px; font-family:sans-serif; position:relative; float:left; width:142px; }
116 display:block; margin:0px 25px; padding:2px 8px; border:solid #d9d8d1; border-width:0px 1px;
117 font-family:monospace; background-color: #edece6;
119 div.link { margin:0px 25px; padding:4px 8px; border:solid #d9d8d1; border-width:0px 1px; font-family:sans-serif; font-size:10px; }
120 a.xml_logo { float:right; border:1px solid;
122 border-color:#fcc7a5 #7d3302 #3e1a01 #ff954e; width:35px;
123 color:#ffffff; background-color:#ff6600;
124 font-weight:bold; font-family:sans-serif; text-align:center;
125 font-size:11px; display:block; text-decoration:none;
127 a.xml_logo:hover { background-color:#ee5500; }
132 print "<div class=\"page_header\">\n" .
133 "<a href=\"$logo_link\">" .
134 "<img src=\"$my_uri?a=git-logo.png\" width=\"72\" height=\"27\" alt=\"git\" style=\"float:right; border-width:0px;\"/></a>";
135 print $cgi->a({-href
=> "$my_uri"}, "projects") . " / ";
136 if ($project ne "") {
137 print $cgi->a({-href
=> "$my_uri?p=$project;a=log"}, $project);
145 sub git_footer_html
{
146 print "<div class=\"page_footer\">";
147 print "<div class=\"page_footer_text\">version $version</div>";
148 if ($project ne '') {
149 print $cgi->a({-href
=> "$my_uri?p=$project;a=rss", -class => "xml_logo"}, "XML") . "\n";
157 my $status = shift || "403 Forbidden";
158 my $error = shift || "Malformed query, file missing or permission denied";
162 git_header_html
($status);
163 print "<div class=\"page_body\">\n" .
166 print "<br/></div>\n";
173 open(my $fd, "$projectroot/$path/HEAD") || die_error
("", "Invalid project directory.");;
185 open my $fd, "-|", "$gitbin/git-cat-file commit $commit";
186 while (my $line = <$fd>) {
189 if ($line =~ m/^tree (.*)$/) {
191 } elsif ($line =~ m/^parent (.*)$/) {
193 } elsif ($line =~ m/^author (.*) ([0-9]+) (.*)$/) {
195 $co{'author_epoch'} = $2;
196 $co{'author_tz'} = $3;
197 $co{'author_name'} = $co{'author'};
198 $co{'author_name'} =~ s/ <.*//;
199 } elsif ($line =~ m/^committer (.*) ([0-9]+) (.*)$/) {
200 $co{'committer'} = $1;
201 $co{'committer_epoch'} = $2;
202 $co{'committer_tz'} = $3;
203 $co{'committer_name'} = $co{'committer'};
204 $co{'committer_name'} =~ s/ <.*//;
207 if (!defined($co{'tree'})) { die_error
("", "Invalid commit object."); }
208 $co{'parents'} = \
@parents;
209 $co{'parent'} = $parents[0];
210 my (@comment) = map { chomp; $_ } <$fd>;
211 $co{'comment'} = \
@comment;
212 $co{'title'} = $comment[0];
215 my $age = time - $co{'committer_epoch'};
217 if ($age > 60*60*24*365*2) {
218 $co{'age_string'} = (int $age/60/60/24/365);
219 $co{'age_string'} .= " years ago";
220 } elsif ($age > 60*60*24*365/12*2) {
221 $co{'age_string'} = int $age/60/60/24/365/12;
222 $co{'age_string'} .= " months ago";
223 } elsif ($age > 60*60*24*7*2) {
224 $co{'age_string'} = int $age/60/60/24/7;
225 $co{'age_string'} .= " weeks ago";
226 } elsif ($age > 60*60*24*2) {
227 $co{'age_string'} = int $age/60/60/24;
228 $co{'age_string'} .= " days ago";
229 } elsif ($age > 60*60*2) {
230 $co{'age_string'} = int $age/60/60;
231 $co{'age_string'} .= " hours ago";
232 } elsif ($age > 60*2) {
233 $co{'age_string'} = int $age/60;
234 $co{'age_string'} .= " minutes ago";
240 my $from_name = shift || "/dev/null";
241 my $to_name = shift || "/dev/null";
245 my $from_tmp = "/dev/null";
246 my $to_tmp = "/dev/null";
247 my $from_label = "/dev/null";
248 my $to_label = "/dev/null";
251 # create tmp from-file
253 $from_tmp = "$gittmp/gitweb_" . $$ . "_from";
254 open(my $fd2, "> $from_tmp");
255 open my $fd, "-|", "$gitbin/git-cat-file blob $from";
260 $from_label = "a/$from_name";
265 $to_tmp = "$gittmp/gitweb_" . $$ . "_to";
266 open my $fd2, "> $to_tmp";
267 open my $fd, "-|", "$gitbin/git-cat-file blob $to";
272 $to_label = "b/$to_name";
275 open my $fd, "-|", "/usr/bin/diff -u -p -L $from_label -L $to_label $from_tmp $to_tmp";
276 print "<span style=\"color: #000099;\">===== ";
278 print $cgi->a({-href
=> "$my_uri?p=$project;a=blob;h=$from"}, $from);
284 print $cgi->a({-href
=> "$my_uri?p=$project;a=blob;h=$to"}, $to);
288 print " =====</span>\n";
289 while (my $line = <$fd>) {
290 my $char = substr($line,0,1);
291 print '<span style="color: #008800;">' if $char eq '+';
292 print '<span style="color: #CC0000;">' if $char eq '-';
293 print '<span style="color: #990099;">' if $char eq '@';
294 print escapeHTML
($line);
295 print '</span>' if $char eq '+' or $char eq '-' or $char eq '@';
308 my $perms = oct shift;
310 if ($perms & 040000) {
311 $modestr .= 'drwxr-xr-x';
313 # git cares only about the executable bit
315 $modestr .= '-rwxr-xr-x';
317 $modestr .= '-rw-r--r--';
325 my $tz = shift || "-0000";
328 my @months = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
329 my @days = ("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
330 my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = gmtime($epoch);
331 $date{'hour'} = $hour;
332 $date{'minute'} = $min;
333 $date{'mday'} = $mday;
334 $date{'day'} = $days[$wday];
335 $date{'month'} = $months[$mon];
336 $date{'rfc2822'} = sprintf "%s, %d %s %4d %02d:%02d:%02d +0000", $days[$wday], $mday, $months[$mon], 1900+$year, $hour ,$min, $sec;
337 $date{'mday-time'} = sprintf "%d %s %02d:%02d", $mday, $months[$mon], $hour ,$min;
339 $tz =~ m/((-|\+)[0-9][0-9])([0-9][0-9])/;
340 my $local = $epoch + (($1 + ($2/60)) * 3600);
341 ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = gmtime($local);
342 $date{'hour_local'} = $hour;
343 $date{'minute_local'} = $min;
344 $date{'tz_local'} = $tz;
348 if ($action eq "git-logo.png") {
349 print $cgi->header(-type
=> 'image/png', -expires
=> '+1d');
350 print "\211\120\116\107\015\012\032\012\000\000\000\015\111\110\104\122".
351 "\000\000\000\110\000\000\000\033\004\003\000\000\000\055\331\324".
352 "\055\000\000\000\030\120\114\124\105\377\377\377\140\140\135\260".
353 "\257\252\000\200\000\316\315\307\300\000\000\350\350\346\367\367".
354 "\366\225\014\247\107\000\000\000\163\111\104\101\124\050\317\143".
355 "\110\147\040\004\112\134\030\012\010\052\142\123\141\040\002\010".
356 "\015\151\105\254\241\241\001\060\014\223\140\066\046\122\221\261".
357 "\001\021\326\341\125\144\154\154\314\154\154\014\242\014\160\052".
358 "\142\006\052\301\142\035\263\001\002\123\244\010\350\000\003\030".
359 "\046\126\021\324\341\040\227\033\340\264\016\065\044\161\051\202".
360 "\231\060\270\223\012\021\271\105\210\301\215\240\242\104\041\006".
361 "\047\101\202\100\205\301\105\211\040\160\001\000\244\075\041\305".
362 "\022\034\232\376\000\000\000\000\111\105\116\104\256\102\140\202";
366 if (!defined($project)) {
367 print $cgi->redirect($home_link);
371 if (!defined($action)) {
375 if (!defined($time_back)) {
379 if ($action eq "blob") {
381 print "<div class=\"page_nav\">\n";
382 print "<br/><br/></div>\n";
383 print "<div class=\"title\">$hash</div>\n";
384 print "<div class=\"page_body\"><pre>\n";
385 open(my $fd, "-|", "$gitbin/git-cat-file blob $hash");
387 while (my $line = <$fd>) {
389 printf "<span style =\"color: #999999;\">%4i\t</span>%s", $nr, escapeHTML
($line);;
392 print "<br/></pre>\n";
395 } elsif ($action eq "tree") {
397 $hash = git_head
($project);
399 open my $fd, "-|", "$gitbin/git-ls-tree $hash";
400 my (@entries) = map { chomp; $_ } <$fd>;
403 print "<div class=\"page_nav\">\n";
404 print "<br/><br/></div>\n";
405 print "<div class=\"title\">$hash</div>\n";
406 print "<div class=\"page_body\">\n";
407 print "<br/><pre>\n";
408 foreach my $line (@entries) {
409 #'100644 blob 0fa3f3a66fb6a137f6ec2c19351ed4d807070ffa panic.c'
410 $line =~ m/^([0-9]+)\t(.*)\t(.*)\t(.*)$/;
415 if ($t_type eq "blob") {
416 print mode_str
($t_mode). " $t_name " . $cgi->a({-href
=> "$my_uri?p=$project;a=blob;h=$t_hash", -class => "link"}, "view") . "\n";
417 } elsif ($t_type eq "tree") {
418 print mode_str
($t_mode). " $t_name " . $cgi->a({-href
=> "$my_uri?p=$project;a=tree;h=$t_hash", -class => "link"}, "view") . "\n";
424 } elsif ($action eq "log" || $action eq "rss") {
425 open my $fd, "-|", "$gitbin/git-rev-list " . git_head
($project);
426 my (@revlist) = map { chomp; $_ } <$fd>;
429 if ($action eq "log") {
431 print "<div class=\"page_nav\">\n";
433 print $cgi->a({-href
=> "$my_uri?p=$project;a=log"}, "last day") . " | \n" .
434 $cgi->a({-href
=> "$my_uri?p=$project;a=log;t=7"}, "week") . " | \n" .
435 $cgi->a({-href
=> "$my_uri?p=$project;a=log;t=31"}, "month") . " | \n" .
436 $cgi->a({-href
=> "$my_uri?p=$project;a=log;t=365"}, "year") . " | \n" .
437 $cgi->a({-href
=> "$my_uri?p=$project;a=log;t=0"}, "all") . "<br/>\n";
438 print "<br/><br/>\n" .
440 } elsif ($action eq "rss") {
441 print $cgi->header(-type
=> 'text/xml', -charset
=> 'utf-8');
442 print "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n".
443 "<rss version=\"0.91\">\n";
445 print "<title>$project</title>\n".
446 "<link> " . $my_url . "/$project/log</link>\n".
447 "<description>$project log</description>\n".
448 "<language>en</language>\n";
451 for (my $i = 0; $i <= $#revlist; $i++) {
452 my $commit = $revlist[$i];
453 my %co = git_commit
($commit);
454 my %ad = date_str
($co{'author_epoch'});
455 if ($action eq "log") {
456 if ($time_back > 0 && $co{'age'} > $time_back*60*60*24) {
458 print "<div class=\"page_body\"> Last change " . $co{'age_string'} . ".<br/><br/></div>\n";
463 $cgi->a({-href
=> "$my_uri?p=$project;a=commit;h=$commit", -class => "log_title"},
464 "<span class=\"log_age\">" . $co{'age_string'} . "</span>" . escapeHTML
($co{'title'})) . "\n" .
466 print "<div class=\"log_head\">\n" .
467 "<div class=\"log_link\">\n" .
468 "view " . $cgi->a({-href
=> "$my_uri?p=$project;a=commit;h=$commit"}, "commit") . " | " .
469 $cgi->a({-href
=> "$my_uri?p=$project;a=commitdiff;h=$commit"}, "diff") . "<br/>\n" .
471 escapeHTML
($co{'author_name'}) . " [" . $ad{'rfc2822'} . "]<br/>\n" .
473 "<div class=\"log_body\">\n";
474 my $comment = $co{'comment'};
475 foreach my $line (@$comment) {
476 last if ($line =~ m/^(signed-off|acked)-by:/i);
477 print escapeHTML
($line) . "<br/>\n";
481 } elsif ($action eq "rss") {
484 "\t<title>" . sprintf("%d %s %02d:%02d", $ad{'mday'}, $ad{'month'}, $ad{'hour'}, $ad{'min'}) . " - " . escapeHTML
($co{'title'}) . "</title>\n" .
485 "\t<link> " . $my_url . "?p=$project;a=commit;h=$commit</link>\n" .
487 my $comment = $co{'comment'};
488 foreach my $line (@$comment) {
489 print escapeHTML
($line) . "\n";
491 print "\t</description>\n" .
495 if ($action eq "log") {
497 } elsif ($action eq "rss") {
498 print "</channel></rss>";
500 } elsif ($action eq "commit") {
501 my %co = git_commit
($hash);
502 my %ad = date_str
($co{'author_epoch'}, $co{'author_tz'});
503 my %cd = date_str
($co{'committer_epoch'}, $co{'committer_tz'});
504 open my $fd, "-|", "$gitbin/git-diff-tree -r " . $co{'parent'} . " $hash";
505 my (@difftree) = map { chomp; $_ } <$fd>;
509 print "<div class=\"page_nav\"> view\n" .
510 $cgi->a({-href
=> "$my_uri?p=$project;a=commit;h=$hash"}, "commit") . " | \n" .
511 $cgi->a({-href
=> "$my_uri?p=$project;a=commitdiff;h=$hash"}, "diffs") . "\n" .
512 "<br/><br/></div>\n";
514 $cgi->a({-href
=> "$my_uri?p=$project;a=commitdiff;h=$hash", -class => "log_title"}, escapeHTML
($co{'title'})) . "\n" .
516 print "<div class=\"log_head\">\n";
517 print "author " . escapeHTML
($co{'author'}) . "<br/>\n";
518 print "author-time " . $ad{'rfc2822'};
519 if ($ad{'hour_local'} < 6) { print "<span style=\"color: #cc0000;\">"; }
520 printf(" (%02d:%02d %s)", $ad{'hour_local'}, $ad{'minute_local'}, $ad{'tz_local'});
521 if ($ad{'hour_local'} < 6 ) { print "</span>"; }
523 print "committer " . escapeHTML
($co{'committer'}) . "<br/>\n";
524 print "commit-time " . $cd{'rfc2822'};
525 printf(" (%02d:%02d %s)", $cd{'hour_local'}, $cd{'minute_local'}, $cd{'tz_local'});
527 print "commit   $hash<br/>\n";
528 print "tree  " . $cgi->a({-href
=> "$my_uri?p=$project;a=tree;h=$co{'tree'}"}, $co{'tree'}) . "<br/>\n";
529 my $parents = $co{'parents'};
530 foreach my $par (@$parents) {
531 print "parent    " . $cgi->a({-href
=> "$my_uri?p=$project;a=commit;h=$par"}, $par) . "<br/>\n";
534 print "<div class=\"page_body\">\n";
535 my $comment = $co{'comment'};
536 foreach my $line (@$comment) {
537 if ($line =~ m/(signed-off|acked)-by:/i) {
538 print "<span style=\"color: #a9a8a1\">" . escapeHTML
($line) . "</span><br/>\n";
540 print escapeHTML
($line) . "<br/>\n";
543 print "<br/><br/>\n" .
545 foreach my $line (@difftree) {
546 # '*100644->100644 blob 9f91a116d91926df3ba936a80f020a6ab1084d2b->bb90a0c3a91eb52020d0db0e8b4f94d30e02d596 net/ipv4/route.c'
547 # '+100644 blob 4a83ab6cd565d21ab0385bac6643826b83c2fcd4 arch/arm/lib/bitops.h'
548 # '*100664->100644 blob b1a8e3dd5556b61dd771d32307c6ee5d7150fa43->b1a8e3dd5556b61dd771d32307c6ee5d7150fa43 show-files.c'
549 # '*100664->100644 blob d08e895238bac36d8220586fdc28c27e1a7a76d3->d08e895238bac36d8220586fdc28c27e1a7a76d3 update-cache.c'
550 $line =~ m/^(.)(.*)\t(.*)\t(.*)\t(.*)$/;
557 if ($type eq "blob") {
559 print "<div class=\"list\">\n" .
560 "$file <span style=\"color: #55cc55;\">[new]</span>\n" .
562 print "<div class=\"link\">\n" .
563 "view " . $cgi->a({-href
=> "$my_uri?p=$project;a=blob;h=$id"}, "file") . "<br/><br/>\n" .
565 } elsif ($op eq "-") {
566 print "<div class=\"list\">\n" .
567 "$file <span style=\"color: #cc5555;\">[removed]</span>\n" .
569 print "<div class=\"link\">\n" .
570 "view " . $cgi->a({-href
=> "$my_uri?p=$project;a=blob;h=$id"}, "file") . "<br/><br/>\n" .
572 } elsif ($op eq "*") {
573 $id =~ m/([0-9a-fA-F]+)->([0-9a-fA-F]+)/;
576 $mode =~ m/^([0-7]{6})->([0-7]{6})$/;
579 print "<div class=\"list\">\n";
581 if ($from_mode != $to_mode) {
582 print "<span style=\"color: #555555;\"> [chmod $mode]</span>";
585 print "<div class=\"link\">\n" .
586 "view " . $cgi->a({-href
=> "$my_uri?p=$project;a=blob;h=$to_id"}, "file") . " | ";
587 if ($to_id ne $from_id) {
588 print $cgi->a({-href
=> "$my_uri?p=$project;a=blobdiff;h=$to_id;hp=$from_id"}, "diff") . " | ";
590 print $cgi->a({-href
=> "$my_uri?p=$project;a=history;h=$hash;f=$file"}, "history") . "<br/><br/>\n" .
596 } elsif ($action eq "blobdiff") {
598 print "<div class=\"page_nav\">\n";
599 print "<br/><br/></div>\n";
600 print "<div class=\"title\">$hash vs $hash_parent</div>\n";
601 print "<div class=\"page_body\">\n" .
603 git_diff_html
($hash_parent, $hash, $hash_parent, $hash);
607 } elsif ($action eq "commitdiff") {
608 my %co = git_commit
($hash);
609 open my $fd, "-|", "$gitbin/git-diff-tree -r " . $co{'parent'} . " $hash";
610 my (@difftree) = map { chomp; $_ } <$fd>;
614 print "<div class=\"page_nav\"> view\n" .
615 $cgi->a({-href
=> "$my_uri?p=$project;a=commit;h=$hash"}, "commit") . " | \n" .
616 $cgi->a({-href
=> "$my_uri?p=$project;a=commitdiff;h=$hash"}, "diffs") . "\n" .
617 "<br/><br/></div>\n";
619 $cgi->a({-href
=> "$my_uri?p=$project;a=commit;h=$hash", -class => "log_title"}, escapeHTML
($co{'title'})) . "\n" .
621 print "<div class=\"page_body\">\n" .
623 foreach my $line (@difftree) {
624 # '*100644->100644 blob 8e5f9bbdf4de94a1bc4b4da8cb06677ce0a57716->8da3a306d0c0c070d87048d14a033df02f40a154 Makefile'
625 $line =~ m/^(.)(.*)\t(.*)\t(.*)\t(.*)$/;
631 if ($type eq "blob") {
633 git_diff_html
("", $file, "", $id);
634 } elsif ($op eq "-") {
635 git_diff_html
($file, "", $id, "");
636 } elsif ($op eq "*") {
637 $id =~ m/([0-9a-fA-F]+)->([0-9a-fA-F]+)/;
639 git_diff_html
($file, $file, $1, $2);
644 print "<br/></pre>\n";
647 } elsif ($action eq "history") {
648 if (!(defined($hash))) {
649 $hash = git_head
($project);
651 open my $fd, "-|", "$gitbin/git-rev-list $hash";
652 my (@revlist) = map { chomp; $_ } <$fd>;
656 print "<div class=\"page_nav\">\n";
657 print "<br/><br/></div>\n";
658 print "<div class=\"title\">". escapeHTML
($file_name) . "</div>\n";
659 print "<div class=\"page_body\">\n" .
662 foreach my $rev (@revlist) {
663 my %co = git_commit
($rev);
664 my $parents = $co{'parents'};
666 foreach my $parent (@$parents) {
667 open $fd, "-|", "$gitbin/git-diff-tree -r $parent $rev $file_name";
668 my (@difftree) = map { chomp; $_ } <$fd>;
671 foreach my $line (@difftree) {
672 $line =~ m/^(.)(.*)\t(.*)\t(.*)\t(.*)$/;
674 if ($file eq $file_name) {
681 print "<div class=\"list\">\n" .
682 $co{'age_string'} . "" . $co{'title'} . "\n" .
684 print "<div class=\"link\">\n" .
686 $cgi->a({-href
=> "$my_uri?p=$project;a=commit;h=$rev"}, "commit") . " | " .
687 $cgi->a({-href
=> "$my_uri?p=$project;a=tree;h=$rev"}, "tree") . "<br/><br/>\n" .
693 die_error
("", "unknown action");
This page took 1.070147 seconds and 3 git commands to generate.