dd4f963fa6450d995dcf8243770ede976c8565d9
1#!/usr/bin/perl
2
3# gitweb.pl - simple web interface to track changes in git repositories
4#
5# Version 042
6#
7# (C) 2005, Kay Sievers <kay.sievers@vrfy.org>
8# (C) 2005, Christian Gierke <ch@gierke.de>
9#
10# This file is licensed under the GPL v2, or a later version
11
12use strict;
13use warnings;
14use CGI qw(:standard :escapeHTML);
15use CGI::Carp qw(fatalsToBrowser);
16
17my $cgi = new CGI;
18
19my $projectroot = "/";
20my $defaultprojects = "home/kay/public_html";
21my $gitbin = "/home/kay/bin/git";
22my $gittmp = "/tmp";
23my $my_url = $cgi->url();
24my $my_uri = $cgi->url(-absolute => 1);
25
26my $project = $cgi->param('p');
27my $action = $cgi->param('a');
28my $hash = $cgi->param('h');
29my $hash_parent = $cgi->param('hp');
30my $time_back = $cgi->param('t') || 1;
31$ENV{'SHA1_FILE_DIRECTORY'} = "$projectroot/$project/.git/objects";
32
33# sanitize input
34$action =~ s/[^0-9a-zA-Z\.\-]//g;
35$project =~ s/\/\.//g;
36$project =~ s/^\/+//g;
37$project =~ s/\/+$//g;
38$project =~ s/|//g;
39$hash =~ s/[^0-9a-fA-F]//g;
40$hash_parent =~ s/[^0-9a-fA-F]//g;
41$time_back =~ s/[^0-9]+//g;
42
43sub git_header_html {
44 print $cgi->header(-type => 'text/html', -charset => 'utf-8');
45print <<EOF;
46<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
47<html>
48<head>
49 <title>git - $project $action</title>
50 <link rel="alternate" title="$project log" href="$my_uri?p=$project;a=rss" type="application/rss+xml"/>
51 <style type="text/css">
52 body { font-family: sans-serif; font-size: 12px; margin:25px; }
53 div.body { border-width:1px; border-style:solid; border-color:#D9D8D1; }
54 div.head1 { font-size:18px; padding:8px; background-color: #D9D8D1; font-weight:bold; }
55 div.head1 a:visited { color:#0000cc; }
56 div.head1 a:hover { color:#880000; }
57 div.head1 a:active { color:#880000; }
58 div.head2 { padding:8px; }
59 div.head2 a:visited { color:#0000cc; }
60 div.head2 a:hover { color:#880000; }
61 div.head2 a:active { color:#880000; }
62 div.title { padding:8px; background-color: #D9D8D1; font-weight:bold; }
63 div.title a { color:#000000; text-decoration:none; }
64 div.title a:hover { color:#880000; text-decoration:underline; }
65 div.title a:visited { color:#000000; }
66 table { padding:0px; margin:0px; width:100%; }
67 tr { vertical-align:top; }
68 td { padding:8px; margin:0px; font-family: sans-serif; font-size: 12px; }
69 td.head1 { background-color: #D9D8D1; font-weight:bold; }
70 td.head1 a { color:#000000; text-decoration:none; }
71 td.head1 a:hover { color:#880000; text-decoration:underline; }
72 td.head1 a:visited { color:#000000; }
73 td.head2 { background-color: #EDECE6; font-family: monospace; font-size:12px; }
74 td.head3 { background-color: #EDECE6; font-size:10px; }
75 div.signed_off { color: #a9a8a1; }
76 a { color:#0000cc; }
77 a:hover { color:#880000; }
78 a:visited { color:#880000; }
79 a:active { color:#880000; }
80 pre { padding:8px; }
81 </style>
82</head>
83<body>
84EOF
85 print "<div class=\"body\">\n";
86 print "<div class=\"head1\">";
87 print "<a href=\"http://kernel.org/pub/software/scm/git/\">" .
88 "<img src=\"$my_uri?a=git-logo.png\" width=\"72\" height=\"27\" alt=\"git\" style=\"float:right; border-width:0px;\"/></a>";
89 if ($defaultprojects ne "") {
90 print $cgi->a({-href => "$my_uri"}, "projects") . " / ";
91 }
92 if ($project ne "") {
93 print $cgi->a({-href => "$my_uri?p=$project;a=log"}, $project);
94 }
95 if ($action ne "") {
96 print " / $action";
97 }
98 print "</div>\n";
99}
100
101sub git_footer_html {
102 print "</div>\n";
103 print "</body>\n</html>";
104}
105
106sub git_head {
107 my $path = shift;
108 open my $fd, "$projectroot/$path/.git/HEAD";
109 my $head = <$fd>;
110 close $fd;
111 chomp $head;
112 return $head;
113}
114
115sub git_commit {
116 my $commit = shift;
117 my %co;
118 my @parents;
119
120 open my $fd, "-|", "$gitbin/cat-file", "commit", $commit;
121 while (my $line = <$fd>) {
122 chomp($line);
123 last if $line eq "";
124 if ($line =~ m/^tree (.*)$/) {
125 $co{'tree'} = $1;
126 } elsif ($line =~ m/^parent (.*)$/) {
127 push @parents, $1;
128 } elsif ($line =~ m/^author (.*) ([0-9]+) (.*)$/) {
129 $co{'author'} = $1;
130 $co{'author_time_epoch'} = $2;
131 $co{'author_timezone'} = $3;
132 $co{'author_name'} = $co{'author'};
133 $co{'author_name'} =~ s/ <.*//;
134 } elsif ($line =~ m/^committer (.*) ([0-9]+) (.*)$/) {
135 $co{'committer'} = $1;
136 $co{'committer_time_epoch'} = $2;
137 $co{'committer_timezone'} = $3;
138 $co{'committer_name'} = $co{'committer'};
139 $co{'committer_name'} =~ s/ <.*//;
140 }
141 }
142 $co{'parents'} = \@parents;
143 $co{'parent'} = $parents[0];
144 my (@comment) = map { chomp; $_ } <$fd>;
145 $co{'comment'} = \@comment;
146 $co{'title'} = $comment[0];
147 close $fd;
148 return %co;
149}
150
151sub git_diff_html {
152 my $from_name = shift || "/dev/null";
153 my $to_name = shift || "/dev/null";
154 my $from = shift;
155 my $to = shift;
156
157 my $from_tmp = "/dev/null";
158 my $to_tmp = "/dev/null";
159 my $from_label = "/dev/null";
160 my $to_label = "/dev/null";
161 my $pid = $$;
162
163 # create temp from-file
164 if ($from ne "") {
165 $from_tmp = "$gittmp/gitweb_" . $$ . "_from";
166 open my $fd2, "> $from_tmp";
167 open my $fd, "-|", "$gitbin/cat-file", "blob", $from;
168 my @file = <$fd>;
169 print $fd2 @file;
170 close $fd2;
171 close $fd;
172 $from_label = "a/$from_name";
173 }
174
175 # create tmp to-file
176 if ($to ne "") {
177 $to_tmp = "$gittmp/gitweb_" . $$ . "_to";
178 open my $fd2, "> $to_tmp";
179 open my $fd, "-|", "$gitbin/cat-file", "blob", $to;
180 my @file = <$fd>;
181 print $fd2 @file;
182 close $fd2;
183 close $fd;
184 $to_label = "b/$to_name";
185 }
186
187 open my $fd, "-|", "/usr/bin/diff", "-L", $from_label, "-L", $to_label, "-u", "-p", $from_tmp, $to_tmp;
188 print "<span style=\"color: #000099;\">===== ";
189 if ($from ne "") {
190 print $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$from"}, $from);
191 } else {
192 print $from_name;
193 }
194 print " vs ";
195 if ($to ne "") {
196 print $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$to"}, $to);
197 } else {
198 print $to_name;
199 }
200 print " =====</span>\n";
201 while (my $line = <$fd>) {
202 my $char = substr($line,0,1);
203 print '<span style="color: #008800;">' if $char eq '+';
204 print '<span style="color: #CC0000;">' if $char eq '-';
205 print '<span style="color: #990099;">' if $char eq '@';
206 print escapeHTML($line);
207 print '</span>' if $char eq '+' or $char eq '-' or $char eq '@';
208 }
209 close $fd;
210
211 if ($from ne "") {
212 unlink("$from_tmp");
213 }
214 if ($to ne "") {
215 unlink("$to_tmp");
216 }
217}
218
219sub mode_str {
220 my $perms = oct shift;
221 my $modestr;
222 if ($perms & 040000) {
223 $modestr .= 'drwxrwxr-x';
224 } else {
225 # git cares only about the executable bit
226 if ($perms & 0100) {
227 $modestr .= '-rwxrwxr-x';
228 } else {
229 $modestr .= '-rw-rw-r--';
230 };
231 }
232 return $modestr;
233}
234
235sub date_str {
236 my $epoch = shift;
237 my $tz = shift || "-0000";
238
239 my %date;
240 my @months = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
241 my @days = ("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
242 my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = gmtime($epoch);
243 $date{'hour'} = $hour;
244 $date{'rfc2822'} = sprintf "%s, %d %s %4d %02d:%02d:%02d +0000", $days[$wday], $mday, $months[$mon], 1900+$year, $hour ,$min, $sec;
245 $date{'mday-time'} = sprintf "%d %s %02d:%02d", $mday, $months[$mon], $hour ,$min;
246
247 $tz =~ m/((-|\+)[0-9][0-9])([0-9][0-9])/;
248 my $local = $epoch + (($1 + ($2/60)) * 3600);
249 ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = gmtime($local);
250 $date{'rfc2822_local'} = sprintf "%s, %d %s %4d %02d:%02d:%02d %s", $days[$wday], $mday, $months[$mon], 1900+$year, $hour ,$min, $sec, $tz;
251 return %date;
252}
253
254if ($action eq "git-logo.png") {
255 print $cgi->header(-type => 'image/png', -expires => '+1d');
256 print "\211\120\116\107\015\012\032\012\000\000\000\015\111\110\104\122".
257 "\000\000\000\110\000\000\000\033\004\003\000\000\000\055\331\324".
258 "\055\000\000\000\030\120\114\124\105\377\377\377\140\140\135\260".
259 "\257\252\000\200\000\316\315\307\300\000\000\350\350\346\367\367".
260 "\366\225\014\247\107\000\000\000\163\111\104\101\124\050\317\143".
261 "\110\147\040\004\112\134\030\012\010\052\142\123\141\040\002\010".
262 "\015\151\105\254\241\241\001\060\014\223\140\066\046\122\221\261".
263 "\001\021\326\341\125\144\154\154\314\154\154\014\242\014\160\052".
264 "\142\006\052\301\142\035\263\001\002\123\244\010\350\000\003\030".
265 "\046\126\021\324\341\040\227\033\340\264\016\065\044\161\051\202".
266 "\231\060\270\223\012\021\271\105\210\301\215\240\242\104\041\006".
267 "\047\101\202\100\205\301\105\211\040\160\001\000\244\075\041\305".
268 "\022\034\232\376\000\000\000\000\111\105\116\104\256\102\140\202";
269 exit;
270}
271
272# show list of default projects
273if ($project eq "") {
274 opendir(my $fd, "$projectroot/$defaultprojects");
275 my (@path) = sort grep(!/^\./, readdir($fd));
276 closedir($fd);
277 git_header_html();
278 print "<div class=\"head2\">\n";
279 print "<br/><br/>\n";
280 foreach my $line (@path) {
281 if (-e "$projectroot/$defaultprojects/$line/.git/HEAD") {
282 print $cgi->a({-href => "$my_uri?p=$defaultprojects/$line;a=log"}, "$defaultprojects/$line") . "<br/>\n";
283 }
284 }
285 print "</div><br/>";
286 git_footer_html();
287 exit;
288}
289
290if ($action eq "blob") {
291 git_header_html();
292 print "<br/><br/>\n";
293 print "<pre>\n";
294 open my $fd, "-|", "$gitbin/cat-file", "blob", $hash;
295 my $nr;
296 while (my $line = <$fd>) {
297 $nr++;
298 printf "<span style =\"color: #999999;\">%3i\t</span>%s", $nr, escapeHTML($line);;
299 }
300 close $fd;
301 print "</pre>\n";
302 print "<br/>";
303 git_footer_html();
304} elsif ($action eq "tree") {
305 if ($hash eq "") {
306 $hash = git_head($project);
307 }
308 open my $fd, "-|", "$gitbin/ls-tree", $hash;
309 my (@entries) = map { chomp; $_ } <$fd>;
310 close $fd;
311 git_header_html();
312 print "<br/><br/>\n";
313 print "<pre>\n";
314 foreach my $line (@entries) {
315 #'100644 blob 0fa3f3a66fb6a137f6ec2c19351ed4d807070ffa panic.c'
316 $line =~ m/^([0-9]+)\t(.*)\t(.*)\t(.*)$/;
317 my $t_mode = $1;
318 my $t_type = $2;
319 my $t_hash = $3;
320 my $t_name = $4;
321 if ($t_type eq "blob") {
322 print mode_str($t_mode). " " . $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$t_hash"}, $t_name) . "\n";
323 } elsif ($t_type eq "tree") {
324 print mode_str($t_mode). " " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$t_hash"}, $t_name) . "\n";
325 }
326 }
327 print "</pre>\n";
328 print "<br/>";
329 git_footer_html();
330} elsif ($action eq "log" || $action eq "rss") {
331 open my $fd, "-|", "$gitbin/rev-list", git_head($project);
332 my (@revtree) = map { chomp; $_ } <$fd>;
333 close $fd;
334
335 if ($action eq "log") {
336 git_header_html();
337 print "<div class=\"head2\">\n";
338 print "view ";
339 print $cgi->a({-href => "$my_uri?p=$project;a=log"}, "last day") . " | ";
340 print $cgi->a({-href => "$my_uri?p=$project;a=log;t=7"}, "week") . " | ";
341 print $cgi->a({-href => "$my_uri?p=$project;a=log;t=31"}, "month") . " | ";
342 print $cgi->a({-href => "$my_uri?p=$project;a=log;t=365"}, "year") . " | ";
343 print $cgi->a({-href => "$my_uri?p=$project;a=log;t=0"}, "all") . "<br/>\n";
344 print "<br/><br/>\n";
345 print "</div>\n";
346 print "<table cellspacing=\"0\" class=\"log\">\n";
347 } elsif ($action eq "rss") {
348 print $cgi->header(-type => 'text/xml', -charset => 'utf-8');
349 print "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n".
350 "<rss version=\"0.91\">\n";
351 print "<channel>\n";
352 print "<title>$project</title>\n".
353 "<link> " . $my_url . "/$project/log</link>\n".
354 "<description>$project log</description>\n".
355 "<language>en</language>\n";
356 }
357
358 for (my $i = 0; $i <= $#revtree; $i++) {
359 my $commit = $revtree[$i];
360 my %co = git_commit($commit);
361 my %ad = date_str($co{'author_time_epoch'});
362 my $age = time - $co{'committer_time_epoch'};
363 my $age_string;
364 if ($age > 60*60*24*365*2) {
365 $age_string = int $age/60/60/24/365;
366 $age_string .= " years ago";
367 } elsif ($age > 60*60*24*365/12*2) {
368 $age_string = int $age/60/60/24/365/12;
369 $age_string .= " months ago";
370 } elsif ($age > 60*60*24*7*2) {
371 $age_string = int $age/60/60/24/7;
372 $age_string .= " weeks ago";
373 } elsif ($age > 60*60*24*2) {
374 $age_string = int $age/60/60/24;
375 $age_string .= " days ago";
376 } elsif ($age > 60*60*2) {
377 $age_string = int $age/60/60;
378 $age_string .= " hours ago";
379 } elsif ($age > 60*2) {
380 $age_string = int $age/60;
381 $age_string .= " minutes ago";
382 }
383 if ($action eq "log") {
384 if ($time_back > 0 && $age > $time_back*60*60*24) {
385 if ($i == 0) {
386 print "<tr>\n";
387 print "<td class=\"head1\"> Last change $age_string. </td>\n";
388 print "</tr>\n";
389 }
390 last;
391 }
392 print "<tr>\n";
393 print "<td class=\"head1\">" . $age_string . "</td>\n";
394 print "<td class=\"head1\">" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"}, $co{'title'}) . "</td>";
395 print "</tr>\n";
396 print "<tr>\n";
397 print "<td class=\"head3\">";
398 print $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"}, "view commit") . "<br/>\n";
399 print $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$commit"}, "view diff") . "<br/>\n";
400 print "</td>\n";
401 print "<td class=\"head2\">\n";
402 print escapeHTML($co{'author_name'}) . " [" . $ad{'rfc2822'} . "]<br/>\n";
403 print "</td>";
404 print "</tr>\n";
405 print "<tr>\n";
406 print "<td></td>\n";
407 print "<td>\n";
408 my $comment = $co{'comment'};
409 foreach my $line (@$comment) {
410 if ($line =~ m/^(signed-off|acked)-by:/i) {
411 print '<div class="signed_off">' . escapeHTML($line) . "<br/></div>\n";
412 } else {
413 print escapeHTML($line) . "<br/>\n";
414 }
415 }
416 print "<br/><br/>\n";
417 print "</td>";
418 print "</tr>\n";
419 } elsif ($action eq "rss") {
420 last if ($i >= 20);
421 print "<item>\n\t<title>" . $ad{'mday-time'} . " - " . escapeHTML($co{'title'}) . "</title>\n";
422 print "\t<link> " . $my_url . "/$project/commit/$commit</link>\n";
423 print "\t<description>";
424 my $comment = $co{'comment'};
425 foreach my $line (@$comment) {
426 print escapeHTML($line) . "\n";
427 }
428 print "\t</description>\n";
429 print "</item>\n";
430 }
431 }
432 if ($action eq "log") {
433 print "</table>\n";
434 git_footer_html();
435 } elsif ($action eq "rss") {
436 print "</channel></rss>";
437 }
438} elsif ($action eq "commit") {
439 my %co = git_commit($hash);
440 my %ad = date_str($co{'author_time_epoch'}, $co{'author_time_zone'});
441 my %cd = date_str($co{'committer_time_epoch'}, $co{'committer_time_zone'});
442 open my $fd, "-|", "$gitbin/diff-tree", "-r", $co{'parent'}, $hash;
443 my (@difftree) = map { chomp; $_ } <$fd>;
444 close $fd;
445
446 git_header_html();
447 print "<div class=\"head2\"> view\n";
448 print $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash"}, "commit") . " | ";
449 print $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash"}, "diff");
450 print "</div><br/><br/>\n";
451 print "<div class=\"title\">" . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash"}, $co{'title'}) . "<br/></div>\n";
452 print "<table cellspacing=\"0\" class=\"log\">\n";
453 print "<tr>\n";
454 print "<td class=\"head2\">";
455 print "author " . escapeHTML($co{'author'}) . " [" . $ad{'rfc2822'} . "]<br/>\n";
456 if ($ad{'hour'} < 7 ) { print "<span style=\"color: #990000;\">"; }
457 print "localtime " . $ad{'rfc2822_local'} . "<br/>\n";
458 if ($ad{'hour'} < 7 ) { print "</span>"; }
459 print "committer " . escapeHTML($co{'committer'}) . " [" . $cd{'rfc2822'} . "]<br/>\n";
460 print "commit $hash<br/>\n";
461 print "tree " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'}"}, $co{'tree'}) . "<br/>\n";
462 my $parents = $co{'parents'};
463 foreach my $par (@$parents) {
464 print "parent " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$par"}, $par) . "<br/>\n";
465 }
466 print "</td>";
467 print "</tr>\n";
468 print "<tr>\n";
469 print "<td>\n";
470 my $comment = $co{'comment'};
471 foreach my $line (@$comment) {
472 if ($line =~ m/(signed-off|acked)-by:/i) {
473 print '<div class="signed_off">' . escapeHTML($line) . "<br/></div>\n";
474 } else {
475 print escapeHTML($line) . "<br/>\n";
476 }
477 }
478 print "<br/><br/>\n";
479 print "</td>";
480 print "</tr>\n";
481 print "</table>";
482
483 print "<pre>\n";
484 foreach my $line (@difftree) {
485 # '*100644->100644 blob 9f91a116d91926df3ba936a80f020a6ab1084d2b->bb90a0c3a91eb52020d0db0e8b4f94d30e02d596 net/ipv4/route.c'
486 # '+100644 blob 4a83ab6cd565d21ab0385bac6643826b83c2fcd4 arch/arm/lib/bitops.h'
487 $line =~ m/^(.)(.*)\t(.*)\t(.*)\t(.*)$/;
488 my $op = $1;
489 my $mode = $2;
490 my $type = $3;
491 my $id = $4;
492 my $file = $5;
493 $mode =~ m/^([0-7]{6})/;
494 my $modestr = mode_str($1);
495 if ($type eq "blob") {
496 if ($op eq "+") {
497 print "$modestr " . $cgi->a({-href => "$my_uri?p=$project;a=blobdiff;h=$id"}, $file) . " (new)\n";
498 } elsif ($op eq "-") {
499 print "$modestr " . $cgi->a({-href => "$my_uri?p=$project;a=blobdiff;hp=$id"}, $file) . " (removed)\n";
500 } elsif ($op eq "*") {
501 $id =~ m/([0-9a-fA-F]+)->([0-9a-fA-F]+)/;
502 my $from = $1;
503 my $to = $2;
504 print "$modestr " . $cgi->a({-href => "$my_uri?p=$project;a=blobdiff;h=$to;hp=$from"}, $file) . "\n";
505 }
506 }
507 }
508 print "</pre>\n";
509 print "<br/>";
510 git_footer_html();
511} elsif ($action eq "blobdiff") {
512 git_header_html();
513 print "<br/><br/>\n";
514 print "<pre>\n";
515 git_diff_html($hash_parent, $hash, $hash_parent, $hash);
516 print "</pre>\n";
517 print "<br/>";
518 git_footer_html();
519} elsif ($action eq "commitdiff") {
520 my %co = git_commit($hash);
521 open my $fd, "-|", "$gitbin/diff-tree", "-r", $co{'parent'}, $hash;
522 my (@difftree) = map { chomp; $_ } <$fd>;
523 close $fd;
524
525 git_header_html();
526 print "<div class=\"head2\"> view\n";
527 print $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash"}, "commit") . " | ";
528 print $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash"}, "diff");
529 print "</div><br/><br/>\n";
530 print "<div class=\"title\">" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash"}, $co{'title'}) . "<br/></div>\n";
531 print "<pre>\n";
532 foreach my $line (@difftree) {
533 # '*100644->100644 blob 8e5f9bbdf4de94a1bc4b4da8cb06677ce0a57716->8da3a306d0c0c070d87048d14a033df02f40a154 Makefile'
534 $line =~ m/^(.)(.*)\t(.*)\t(.*)\t(.*)$/;
535 my $op = $1;
536 my $mode = $2;
537 my $type = $3;
538 my $id = $4;
539 my $file = $5;
540 if ($type eq "blob") {
541 if ($op eq "+") {
542 git_diff_html("", $file, "", $id);
543 } elsif ($op eq "-") {
544 git_diff_html($file, "", $id, "");
545 } elsif ($op eq "*") {
546 $id =~ m/([0-9a-fA-F]+)->([0-9a-fA-F]+)/;
547 git_diff_html($file, $file, $1, $2);
548 }
549 }
550 }
551 print "</pre>\n";
552 print "<br/>";
553 git_footer_html();
554} else {
555 git_header_html();
556 print "<div class=\"head2\">\n";
557 print "unknown action";
558 print "</div><br/><br/>\n";
559 git_footer_html();
560}