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 program is licensed under the GPL v2, or a later version
12 use CGI qw(:standard :escapeHTML);
13 use CGI::Carp qw(fatalsToBrowser);
18 my $my_url = $cgi->url();
19 my $my_uri = $cgi->url(-absolute => 1);
22 # absolute fs-path which will be prepended to the project path
23 my $projectroot = "/pub/scm";
25 # location of the git-core binaries
26 my $gitbin = "/usr/bin";
28 # location for temporary files needed for diffs
29 my $gittmp = "/tmp/gitweb";
31 # target of the home link on top of all pages
32 my $home_link = $my_uri;
34 # html text to include at home page
35 my $home_text = "indextext.html";
37 # source of projects list
38 #my $projects_list = $projectroot;
39 my $projects_list = "index/index.txt";
41 # input validation and dispatch
42 my $action = $cgi->param('a');
43 if (defined $action) {
44 if ($action =~ m/[^0-9a-zA-Z\.\-]+/) {
46 die_error(undef, "Invalid action parameter.");
48 if ($action eq "git-logo.png") {
56 my $project = $cgi->param('p');
57 if (defined $project) {
58 if ($project =~ m/(^|\/)(|\.|\.\.)($|\/)/) {
60 die_error(undef, "Non-canonical project parameter.");
62 if ($project =~ m/[^a-zA-Z0-9_\.\/\-\+\#\~]/) {
64 die_error(undef, "Invalid character in project parameter.");
66 if (!(-d "$projectroot/$project")) {
68 die_error(undef, "No such directory.");
70 if (!(-e "$projectroot/$project/HEAD")) {
72 die_error(undef, "No such project.");
74 $rss_link = "<link rel=\"alternate\" title=\"$project log\" href=\"$my_uri?p=$project;a=rss\" type=\"application/rss+xml\"/>";
75 $ENV{'GIT_OBJECT_DIRECTORY'} = "$projectroot/$project/objects";
76 $ENV{'SHA1_FILE_DIRECTORY'} = "$projectroot/$project/objects";
82 my $file_name = $cgi->param('f');
83 if (defined $file_name) {
84 if ($file_name =~ m/(^|\/)(|\.|\.\.)($|\/)/) {
86 die_error(undef, "Non-canonical file parameter.");
88 if ($file_name =~ m/[^a-zA-Z0-9_\.\/\-\+\#\~\:\!]/) {
90 die_error(undef, "Invalid character in file parameter.");
94 my $hash = $cgi->param('h');
95 if (defined $hash && !($hash =~ m/^[0-9a-fA-F]{40}$/)) {
97 die_error(undef, "Invalid hash parameter.");
100 my $hash_parent = $cgi->param('hp');
101 if (defined $hash_parent && !($hash_parent =~ m/^[0-9a-fA-F]{40}$/)) {
103 die_error(undef, "Invalid hash_parent parameter.");
106 my $hash_base = $cgi->param('hb');
107 if (defined $hash_base && !($hash_base =~ m/^[0-9a-fA-F]{40}$/)) {
109 die_error(undef, "Invalid parent hash parameter.");
112 my $time_back = $cgi->param('t');
113 if (defined $time_back) {
114 if ($time_back =~ m/^[^0-9]+$/) {
116 die_error(undef, "Invalid time parameter.");
120 if ($action eq "summary") {
123 } elsif ($action eq "tags") {
126 } elsif ($action eq "blob") {
129 } elsif ($action eq "tree") {
132 } elsif ($action eq "rss") {
135 } elsif ($action eq "commit") {
138 } elsif ($action eq "log") {
141 } elsif ($action eq "blobdiff") {
144 } elsif ($action eq "commitdiff") {
147 } elsif ($action eq "history") {
152 die_error(undef, "Unknown action.");
156 sub git_header_html {
157 my $status = shift || "200 OK";
160 if (defined $project) {
161 $title .= " - $project";
162 if (defined $action) {
163 $title .= "/$action";
166 print $cgi->header(-type=>'text/html', -charset => 'utf-8', -status=> $status);
168 <?xml version="1.0" encoding="utf-8"?>
169 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
170 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
171 <!-- git web interface v$version, (C) 2005, Kay Sievers <kay.sievers\@vrfy.org>, Christian Gierke <ch\@gierke.de> -->
173 <title>$title</title>
175 <style type="text/css">
176 body { font-family: sans-serif; font-size: 12px; margin:0px; border:solid #d9d8d1; border-width:1px; margin:10px; }
178 a:hover, a:visited, a:active { color:#880000; }
179 div.page_header { height:25px; padding:8px; font-size:18px; font-weight:bold; background-color:#d9d8d1; }
180 div.page_header a:visited { color:#0000cc; }
181 div.page_header a:hover { color:#880000; }
182 div.page_nav { padding:8px; }
183 div.page_nav a:visited { color:#0000cc; }
184 div.page_path { font-weight:bold; padding:8px; border:solid #d9d8d1; border-width:0px 0px 1px}
185 div.page_footer { height:17px; padding:4px 8px; background-color: #d9d8d1; }
186 div.page_footer_text { float:left; color:#555555; font-style:italic; }
187 div.page_body { padding:8px; }
189 display:block; padding:6px 8px;
190 font-weight:bold; background-color:#edece6; text-decoration:none; color:#000000;
192 a.title:hover { background-color: #d9d8d1; }
193 div.title_text { padding:6px 8px; border: solid #d9d8d1; border-width:0px 0px 1px; }
194 div.log_body { padding:8px 8px 8px 150px; }
195 span.log_age { position:relative; float:left; width:142px; font-style:italic; }
197 font-size:10px; font-family:sans-serif; font-style:normal;
198 position:relative; float:left; width:142px;
200 div.list { display:block; padding:4px 8px 2px; }
202 display:block; padding:6px 6px 4px; border:solid #d9d8d1;
203 border-width:0px 0px 1px; font-style:italic;
205 div.list a { text-decoration:none; color:#000000; }
206 div.list a:hover { color:#880000; }
208 padding:4px 8px 6px; border:solid #d9d8d1; border-width:0px 0px 1px;
209 font-family:sans-serif; font-size:10px;
211 td { padding:5px 15px 0px 0px; font-size:12px; }
212 th { padding-right:10px; font-size:12px; text-align:left; }
213 td.link { font-family:sans-serif; font-size:10px; }
214 td.pre { font-family:monospace; font-size:12px; white-space:pre; padding:2px 15px 0px 0px; }
215 div.pre { font-family:monospace; font-size:12px; white-space:pre; }
216 div.diff_info { font-family:monospace; color:#000099; background-color:#edece6; font-style:italic; }
217 div.index_include { border:solid #d9d8d1; border-width:0px 0px 1px; padding:12px 8px; }
218 a.rss_logo { float:right; padding:3px 0px; width:35px; line-height:10px;
219 border:1px solid; border-color:#fcc7a5 #7d3302 #3e1a01 #ff954e;
220 color:#ffffff; background-color:#ff6600;
221 font-weight:bold; font-family:sans-serif; font-size:10px;
222 text-align:center; text-decoration:none;
224 a.rss_logo:hover { background-color:#ee5500; }
229 print "<div class=\"page_header\">\n" .
230 "<a href=\"http://kernel.org/pub/software/scm/git/docs/\">" .
231 "<img src=\"$my_uri?a=git-logo.png\" width=\"72\" height=\"27\" alt=\"git\" style=\"float:right; border-width:0px;\"/></a>";
232 print $cgi->a({-href => $home_link}, "projects") . " / ";
233 if (defined $project) {
234 print $cgi->a({-href => "$my_uri?p=$project;a=summary"}, escapeHTML($project));
235 if (defined $action) {
242 sub git_footer_html {
243 print "<div class=\"page_footer\">\n";
244 if (defined $project) {
245 my $descr = git_read_description($project);
246 if (defined $descr) {
247 print "<div class=\"page_footer_text\">" . escapeHTML($descr) . "</div>\n";
249 print $cgi->a({-href => "$my_uri?p=$project;a=rss", -class => "rss_logo"}, "RSS") . "\n";
257 my $status = shift || "403 Forbidden";
258 my $error = shift || "Malformed query, file missing or permission denied";
260 git_header_html($status);
261 print "<div class=\"page_body\">\n" .
263 print "$status - $error\n";
264 print "<br/></div>\n";
272 open my $fd, "-|", "$gitbin/git-cat-file -t $hash" || return;
282 open my $fd, "$projectroot/$path" || return undef;
286 if ($head =~ m/^[0-9a-fA-F]{40}$/) {
291 sub git_read_description {
294 open my $fd, "$projectroot/$path/description" || return undef;
305 open my $fd, "-|", "$gitbin/git-cat-file tag $tag_id" || return;
306 while (my $line = <$fd>) {
308 if ($line =~ m/^object ([0-9a-fA-F]{40})$/) {
310 } elsif ($line =~ m/^type (.*)$/) {
312 } elsif ($line =~ m/^tag (.*)$/) {
317 if (!defined $tag{'name'}) {
323 sub git_read_commit {
328 open my $fd, "-|", "$gitbin/git-cat-file commit $commit" || return;
329 while (my $line = <$fd>) {
330 last if $line eq "\n";
332 if ($line =~ m/^tree (.*)$/) {
334 } elsif ($line =~ m/^parent (.*)$/) {
336 } elsif ($line =~ m/^author (.*) ([0-9]+) (.*)$/) {
338 $co{'author_epoch'} = $2;
339 $co{'author_tz'} = $3;
340 $co{'author_name'} = $co{'author'};
341 $co{'author_name'} =~ s/ <.*//;
342 } elsif ($line =~ m/^committer (.*) ([0-9]+) (.*)$/) {
343 $co{'committer'} = $1;
344 $co{'committer_epoch'} = $2;
345 $co{'committer_tz'} = $3;
346 $co{'committer_name'} = $co{'committer'};
347 $co{'committer_name'} =~ s/ <.*//;
350 if (!defined $co{'tree'}) {
354 $co{'parents'} = \@parents;
355 $co{'parent'} = $parents[0];
356 my (@comment) = map { chomp; $_ } <$fd>;
357 $co{'comment'} = \@comment;
358 $comment[0] =~ m/^(.{0,60}[^ ]*)/;
360 if ($comment[0] ne $co{'title'}) {
361 $co{'title'} .= " ...";
365 my $age = time - $co{'committer_epoch'};
367 if ($age > 60*60*24*365*2) {
368 $co{'age_string'} = (int $age/60/60/24/365);
369 $co{'age_string'} .= " years ago";
370 } elsif ($age > 60*60*24*(365/12)*2) {
371 $co{'age_string'} = int $age/60/60/24/(365/12);
372 $co{'age_string'} .= " months ago";
373 } elsif ($age > 60*60*24*7*2) {
374 $co{'age_string'} = int $age/60/60/24/7;
375 $co{'age_string'} .= " weeks ago";
376 } elsif ($age > 60*60*24*2) {
377 $co{'age_string'} = int $age/60/60/24;
378 $co{'age_string'} .= " days ago";
379 } elsif ($age > 60*60*2) {
380 $co{'age_string'} = int $age/60/60;
381 $co{'age_string'} .= " hours ago";
382 } elsif ($age > 60*2) {
383 $co{'age_string'} = int $age/60;
384 $co{'age_string'} .= " minutes ago";
386 $co{'age_string'} = int $age;
387 $co{'age_string'} .= " seconds ago";
389 $co{'age_string'} .= " right now";
396 my $from_name = shift;
400 my $from_tmp = "/dev/null";
401 my $to_tmp = "/dev/null";
404 # create tmp from-file
406 $from_tmp = "$gittmp/gitweb_" . $$ . "_from";
407 open my $fd2, "> $from_tmp";
408 open my $fd, "-|", "$gitbin/git-cat-file blob $from";
417 $to_tmp = "$gittmp/gitweb_" . $$ . "_to";
418 open my $fd2, "> $to_tmp";
419 open my $fd, "-|", "$gitbin/git-cat-file blob $to";
426 open my $fd, "-|", "/usr/bin/diff -u -p -L $from_name -L $to_name $from_tmp $to_tmp";
427 while (my $line = <$fd>) {
429 my $char = substr($line, 0, 1);
432 $color = " style=\"color:#008800;\"";
433 } elsif ($char eq '-') {
434 $color = " style=\"color:#cc0000;\"";
435 } elsif ($char eq '@') {
436 $color = " style=\"color:#990099;\"";
437 } elsif ($char eq '\\') {
441 print "<div class=\"pre\"$color>" . escapeHTML($line) . "</div>\n";
454 my $mode = oct shift;
456 if (S_ISDIR($mode & S_IFMT)) {
458 } elsif (S_ISLNK($mode)) {
460 } elsif (S_ISREG($mode)) {
461 # git cares only about the executable bit
462 if ($mode & S_IXUSR) {
473 my $mode = oct shift;
475 if (S_ISDIR($mode & S_IFMT)) {
477 } elsif (S_ISLNK($mode)) {
479 } elsif (S_ISREG($mode)) {
488 my $tz = shift || "-0000";
491 my @months = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
492 my @days = ("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
493 my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = gmtime($epoch);
494 $date{'hour'} = $hour;
495 $date{'minute'} = $min;
496 $date{'mday'} = $mday;
497 $date{'day'} = $days[$wday];
498 $date{'month'} = $months[$mon];
499 $date{'rfc2822'} = sprintf "%s, %d %s %4d %02d:%02d:%02d +0000", $days[$wday], $mday, $months[$mon], 1900+$year, $hour ,$min, $sec;
500 $date{'mday-time'} = sprintf "%d %s %02d:%02d", $mday, $months[$mon], $hour ,$min;
502 $tz =~ m/^([+\-][0-9][0-9])([0-9][0-9])$/;
503 my $local = $epoch + ((int $1 + ($2/60)) * 3600);
504 ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = gmtime($local);
505 $date{'hour_local'} = $hour;
506 $date{'minute_local'} = $min;
507 $date{'tz_local'} = $tz;
511 # git-logo (cached in browser for one day)
513 print $cgi->header(-type => 'image/png', -expires => '+1d');
514 # cat git-logo.png | hexdump -e '16/1 " %02x" "\n"' | sed 's/ /\\x/g'
515 print "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52" .
516 "\x00\x00\x00\x48\x00\x00\x00\x1b\x04\x03\x00\x00\x00\x2d\xd9\xd4" .
517 "\x2d\x00\x00\x00\x18\x50\x4c\x54\x45\xff\xff\xff\x60\x60\x5d\xb0" .
518 "\xaf\xaa\x00\x80\x00\xce\xcd\xc7\xc0\x00\x00\xe8\xe8\xe6\xf7\xf7" .
519 "\xf6\x95\x0c\xa7\x47\x00\x00\x00\x73\x49\x44\x41\x54\x28\xcf\x63" .
520 "\x48\x67\x20\x04\x4a\x5c\x18\x0a\x08\x2a\x62\x53\x61\x20\x02\x08" .
521 "\x0d\x69\x45\xac\xa1\xa1\x01\x30\x0c\x93\x60\x36\x26\x52\x91\xb1" .
522 "\x01\x11\xd6\xe1\x55\x64\x6c\x6c\xcc\x6c\x6c\x0c\xa2\x0c\x70\x2a" .
523 "\x62\x06\x2a\xc1\x62\x1d\xb3\x01\x02\x53\xa4\x08\xe8\x00\x03\x18" .
524 "\x26\x56\x11\xd4\xe1\x20\x97\x1b\xe0\xb4\x0e\x35\x24\x71\x29\x82" .
525 "\x99\x30\xb8\x93\x0a\x11\xb9\x45\x88\xc1\x8d\xa0\xa2\x44\x21\x06" .
526 "\x27\x41\x82\x40\x85\xc1\x45\x89\x20\x70\x01\x00\xa4\x3d\x21\xc5" .
527 "\x12\x1c\x9a\xfe\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82";
533 my ($dev, $ino, $mode, $nlink, $st_uid, $st_gid, $rdev, $size) = stat($path);
534 my ($name, $passwd, $uid, $gid, $quota, $comment, $gcos, $dir, $shell) = getpwuid($st_uid);
535 if (!defined $gcos) {
539 $owner =~ s/[,;].*$//;
543 sub git_project_list {
546 if (-d $projects_list) {
547 # search in directory
548 my $dir = $projects_list;
549 opendir my $dh, $dir || return undef;
550 while (my $dir = readdir($dh)) {
551 if (-e "$projectroot/$dir/HEAD") {
559 } elsif (-f $projects_list) {
561 # 'git/git.git:Linus Torvalds'
562 # 'linux/hotplug/udev.git'
563 open my $fd , $projects_list || return undef;
564 while (my $line = <$fd>) {
566 my ($path, $owner) = split ':', $line;
567 if (!defined $path) {
570 if (-e "$projectroot/$path/HEAD") {
582 die_error(undef, "No project found.");
584 @list = sort {$a->{'path'} cmp $b->{'path'}} @list;
588 print "<div class=\"index_include\">\n";
589 open (my $fd, $home_text);
594 print "<div class=\"page_body\"><br/>\n" .
595 "<table cellspacing=\"0\">\n" .
597 "<th>Project</th>\n" .
598 "<th>Description</th>\n" .
600 "<th>last change</th>\n" .
603 foreach my $pr (@list) {
605 my $head = git_read_hash("$proj{'path'}/HEAD");
606 if (!defined $head) {
609 $ENV{'GIT_OBJECT_DIRECTORY'} = "$projectroot/$proj{'path'}/objects";
610 $ENV{'SHA1_FILE_DIRECTORY'} = "$projectroot/$proj{'path'}/objects";
611 my %co = git_read_commit($head);
615 my $descr = git_read_description($proj{'path'}) || "";
616 # get directory owner if not already specified
617 if (!defined $proj{'owner'}) {
618 $proj{'owner'} = get_file_owner("$projectroot/$proj{'path'}") || "";
621 "<td>" . $cgi->a({-href => "$my_uri?p=" . $proj{'path'} . ";a=summary"}, escapeHTML($proj{'path'})) . "</td>\n" .
622 "<td>$descr</td>\n" .
623 "<td><i>$proj{'owner'}</i></td>\n";
625 if ($co{'age'} < 60*60*2) {
626 $colored_age = "<span style =\"color: #009900;\"><b><i>$co{'age_string'}</i></b></span>";
627 } elsif ($co{'age'} < 60*60*24*2) {
628 $colored_age = "<span style =\"color: #009900;\"><i>$co{'age_string'}</i></span>";
630 $colored_age = "<i>$co{'age_string'}</i>";
632 print "<td>$colored_age</td>\n" .
633 "<td class=\"link\">" .
634 $cgi->a({-href => "$my_uri?p=$proj{'path'};a=summary"}, "summary") .
635 " | " . $cgi->a({-href => "$my_uri?p=$proj{'path'};a=log"}, "log") .
636 " | " . $cgi->a({-href => "$my_uri?p=$proj{'path'};a=tree"}, "tree") .
648 opendir my $dh, "$projectroot/$project/refs/tags";
649 my @tags = grep !m/^\./, readdir $dh;
651 foreach my $tag_file (@tags) {
652 my $tag_id = git_read_hash("$project/refs/tags/$tag_file");
653 my $type = git_get_type($tag_id) || next;
656 if ($type eq "tag") {
657 my %tag = git_read_tag($tag_id);
658 if ($tag{'type'} eq "commit") {
659 %co = git_read_commit($tag{'object'});
661 $tag_item{'type'} = $tag{'type'};
662 $tag_item{'name'} = $tag{'name'};
663 $tag_item{'id'} = $tag{'object'};
664 } elsif ($type eq "commit"){
665 %co = git_read_commit($tag_id);
666 $tag_item{'type'} = "commit";
667 $tag_item{'name'} = $tag_file;
668 $tag_item{'id'} = $tag_id;
670 $tag_item{'epoch'} = $co{'author_epoch'} || 0;
671 $tag_item{'age'} = $co{'age_string'} || "unknown";
673 push @taglist, \%tag_item;
676 @taglist = sort {$b->{'epoch'} <=> $a->{'epoch'}} @taglist;
681 my $descr = git_read_description($project) || "none";
682 my $head = git_read_hash("$project/HEAD");
683 $ENV{'GIT_OBJECT_DIRECTORY'} = "$projectroot/$project/objects";
684 $ENV{'SHA1_FILE_DIRECTORY'} = "$projectroot/$project/objects";
685 my %co = git_read_commit($head);
686 my %cd = date_str($co{'committer_epoch'}, $co{'committer_tz'});
689 if (-f $projects_list) {
690 open (my $fd , $projects_list);
691 while (my $line = <$fd>) {
693 my ($pr, $ow) = split ':', $line;
694 if ($pr eq $project) {
701 if (!defined $owner) {
702 $owner = get_file_owner("$projectroot/$project");
706 print "<div class=\"page_nav\">\n" .
707 $cgi->a({-href => "$my_uri?p=$project;a=log"}, "log") .
708 " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;hb=$head"}, "latest tree") .
711 print "<div class=\"title\">project</div>\n";
712 print "<div class=\"page_body\">\n" .
713 "<table cellspacing=\"0\">\n" .
714 "<tr><td>description</td><td>" . escapeHTML($descr) . "</td></tr>\n" .
715 "<tr><td>owner</td><td>$owner</td></tr>\n" .
716 "<tr><td>last change</td><td>$cd{'rfc2822'}</td></tr>\n" .
719 open my $fd, "-|", "$gitbin/git-rev-list --max-count=11 " . git_read_hash("$project/HEAD") || die_error(undef, "Open failed.");
720 my (@revlist) = map { chomp; $_ } <$fd>;
723 $cgi->a({-href => "$my_uri?p=$project;a=log", -class => "title"}, "recent commits") .
726 foreach my $commit (@revlist) {
727 my %co = git_read_commit($commit);
728 my %ad = date_str($co{'author_epoch'});
729 print "<div class=\"list\">\n" .
730 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"},
731 "<span class=\"log_age\">" . $co{'age_string'} . "</span>" . escapeHTML($co{'title'})) . "\n" .
734 print "<div class=\"list\">" . $cgi->a({-href => "$my_uri?p=$project;a=log"}, "...") . "</div>\n";
740 my $taglist = git_read_tags();
741 if (defined @$taglist) {
743 $cgi->a({-href => "$my_uri?p=$project;a=tags", -class => "title"}, "recent tags") .
746 foreach my $entry (@$taglist) {
748 print "<div class=\"list\">\n" .
749 $cgi->a({-href => "$my_uri?p=$project;a=$tag{'type'};h=$tag{'id'}"},
750 "<span class=\"log_age\">$tag{'age'}</span>" . escapeHTML($tag{'name'})) . "\n" .
753 print "<div class=\"list\">" . $cgi->a({-href => "$my_uri?p=$project;a=tags"}, "...") . "</div>\n";
763 my $head = git_read_hash("$project/HEAD");
765 print "<div class=\"page_nav\">\n" .
766 $cgi->a({-href => "$my_uri?p=$project;a=log"}, "log") .
767 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$head"}, "commit") .
768 " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree"}, "tree") .
771 my $taglist = git_read_tags();
773 $cgi->a({-href => "$my_uri?p=$project;a=summary", -class => "title"}, "tags") .
775 if (defined @$taglist) {
776 foreach my $entry (@$taglist) {
778 print "<div class=\"list\">\n" .
779 $cgi->a({-href => "$my_uri?p=$project;a=$tag{'type'};h=$tag{'id'}"},
780 "<span class=\"log_age\">$tag{'age'}</span>" . escapeHTML($tag{'name'})) . "\n" .
788 sub git_get_hash_by_path {
793 my @parts = split '/', $path;
794 while (my $part = shift @parts) {
795 open my $fd, "-|", "$gitbin/git-ls-tree $tree" || die_error(undef, "Open git-ls-tree failed.");
796 my (@entries) = map { chomp; $_ } <$fd>;
797 close $fd || return undef;
798 foreach my $line (@entries) {
799 #'100644 blob 0fa3f3a66fb6a137f6ec2c19351ed4d807070ffa panic.c'
800 $line =~ m/^([0-9]+)\t(.*)\t(.*)\t(.*)$/;
805 if ($t_name eq $part) {
809 if ($t_type eq "tree") {
819 if (!defined $hash && defined $file_name) {
820 my $base = $hash_base || git_read_hash("$project/HEAD");
821 $hash = git_get_hash_by_path($base, $file_name, "blob");
823 open my $fd, "-|", "$gitbin/git-cat-file blob $hash" || die_error(undef, "Open failed.");
824 my $base = $file_name || "";
826 if (defined $hash_base && (my %co = git_read_commit($hash_base))) {
827 print "<div class=\"page_nav\">\n" .
828 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash_base"}, "commit") .
829 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash_base"}, "commitdiff") .
830 " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=" . $co{'tree'} . ";hb=$hash_base"}, "tree");
831 if (defined $file_name) {
832 print " | " . $cgi->a({-href => "$my_uri?p=$project;a=history;h=$hash_base;f=$file_name"}, "history");
834 print "<br/><br/>\n" .
837 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash_base", -class => "title"}, escapeHTML($co{'title'})) .
840 print "<div class=\"page_nav\">\n" .
841 "<br/><br/></div>\n" .
842 "<div class=\"title\">$hash</div>\n";
844 if (defined $file_name) {
845 print "<div class=\"page_path\">/$file_name</div>\n";
847 print "<div class=\"page_body\">\n";
849 while (my $line = <$fd>) {
852 print "<div class=\"pre\">";
853 printf "<span style=\"color:#999999;\">%4i</span>", $nr;
854 print " " .escapeHTML($line) . "</div>\n";
856 close $fd || print "Reading blob failed.\n";
862 if (!defined $hash) {
863 $hash = git_read_hash("$project/HEAD");
864 if (defined $file_name) {
865 my $base = $hash_base || git_read_hash("$project/HEAD");
866 $hash = git_get_hash_by_path($base, $file_name, "tree");
869 open my $fd, "-|", "$gitbin/git-ls-tree $hash" || die_error(undef, "Open git-ls-tree failed.");
870 my (@entries) = map { chomp; $_ } <$fd>;
871 close $fd || die_error(undef, "Reading tree failed.");
877 if (defined $hash_base && (my %co = git_read_commit($hash_base))) {
878 $base_key = ";hb=$hash_base";
879 print "<div class=\"page_nav\">\n" .
880 $cgi->a({-href => "$my_uri?p=$project;a=log"}, "log") .
881 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash_base"}, "commit") .
882 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash_base"}, "commitdiff") .
883 " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash_base"}, "tree") .
887 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash_base", -class => "title"}, escapeHTML($co{'title'})) . "\n" .
890 print "<div class=\"page_nav\">\n";
891 print "<br/><br/></div>\n";
892 print "<div class=\"title\">$hash</div>\n";
894 if (defined $file_name) {
895 $base = "$file_name/";
896 print "<div class=\"page_path\">/$file_name</div>\n";
898 print "<div class=\"page_path\">/</div>\n";
900 print "<div class=\"page_body\">\n";
901 print "<table cellspacing=\"0\">\n";
902 foreach my $line (@entries) {
903 #'100644 blob 0fa3f3a66fb6a137f6ec2c19351ed4d807070ffa panic.c'
904 $line =~ m/^([0-9]+)\t(.*)\t(.*)\t(.*)$/;
909 $file_key = ";f=$base$t_name";
911 "<td class=\"pre\">" . mode_str($t_mode) . "</td>\n";
912 if ($t_type eq "blob") {
913 print "<td class=\"pre\">$t_name</td>\n";
914 print "<td class=\"link\">" .
915 $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$t_hash" . $base_key . $file_key}, "blob") .
916 " | " . $cgi->a({-href => "$my_uri?p=$project;a=history;h=$hash_base" . $file_key}, "history") .
918 } elsif ($t_type eq "tree") {
919 print "<td class=\"pre\">" .
920 $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$t_hash" . $base_key . $file_key}, $t_name) .
931 open my $fd, "-|", "$gitbin/git-rev-list --max-count=20 " . git_read_hash("$project/HEAD") || die_error(undef, "Open failed.");
932 my (@revlist) = map { chomp; $_ } <$fd>;
933 close $fd || die_error(undef, "Reading rev-list failed.");
935 print $cgi->header(-type => 'text/xml', -charset => 'utf-8');
936 print "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n".
937 "<rss version=\"0.91\">\n";
939 print "<title>$project</title>\n".
940 "<link> " . $my_url . "/$project/log</link>\n".
941 "<description>$project log</description>\n".
942 "<language>en</language>\n";
944 foreach my $commit (@revlist) {
945 my %co = git_read_commit($commit);
946 my %ad = date_str($co{'author_epoch'});
948 "\t<title>" . sprintf("%d %s %02d:%02d", $ad{'mday'}, $ad{'month'}, $ad{'hour'}, $ad{'minute'}) . " - " . escapeHTML($co{'title'}) . "</title>\n" .
949 "\t<link> " . $my_url . "?p=$project;a=commit;h=$commit</link>\n" .
951 my $comment = $co{'comment'};
952 foreach my $line (@$comment) {
953 print escapeHTML($line) . "<br/>\n";
955 print "\t</description>\n" .
958 print "</channel></rss>";
962 my $head = git_read_hash("$project/HEAD");
963 my $limit_option = "";
964 if (!defined $time_back) {
965 $limit_option = "--max-count=10";
966 } elsif ($time_back > 0) {
967 my $date = time - $time_back*24*60*60;
968 $limit_option = "--max-age=$date";
970 open my $fd, "-|", "$gitbin/git-rev-list $limit_option $head" || die_error(undef, "Open failed.");
971 my (@revlist) = map { chomp; $_ } <$fd>;
972 close $fd || die_error(undef, "Reading rev-list failed.");
975 print "<div class=\"page_nav\">\n";
976 print $cgi->a({-href => "$my_uri?p=$project;a=log"}, "last 10") . " | " .
977 $cgi->a({-href => "$my_uri?p=$project;a=log;t=1"}, "day") . " | " .
978 $cgi->a({-href => "$my_uri?p=$project;a=log;t=7"}, "week") . " | " .
979 $cgi->a({-href => "$my_uri?p=$project;a=log;t=31"}, "month") . " | " .
980 $cgi->a({-href => "$my_uri?p=$project;a=log;t=365"}, "year") . " | " .
981 $cgi->a({-href => "$my_uri?p=$project;a=log;t=0"}, "all") . "<br/>\n";
986 my %co = git_read_commit($head);
987 print "<div class=\"page_body\"> Last change " . $co{'age_string'} . ".<br/><br/></div>\n";
990 foreach my $commit (@revlist) {
991 my %co = git_read_commit($commit);
993 my %ad = date_str($co{'author_epoch'});
995 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit", -class => "title"},
996 "<span class=\"log_age\">" . $co{'age_string'} . "</span>" . escapeHTML($co{'title'})) . "\n" .
998 print "<div class=\"title_text\">\n" .
999 "<div class=\"log_link\">\n" .
1000 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"}, "commit") .
1001 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$commit"}, "commitdiff") .
1004 "<i>" . escapeHTML($co{'author_name'}) . " [" . $ad{'rfc2822'} . "]</i><br/>\n" .
1006 "<div class=\"log_body\">\n";
1007 my $comment = $co{'comment'};
1009 foreach my $line (@$comment) {
1010 if ($line =~ m/^(signed[ \-]off[\-]by[ :]|acked[\-]by[ \:]|cc[ :])/i) {
1021 print escapeHTML($line) . "<br/>\n";
1032 my %co = git_read_commit($hash);
1034 die_error(undef, "Unknown commit object.");
1036 my %ad = date_str($co{'author_epoch'}, $co{'author_tz'});
1037 my %cd = date_str($co{'committer_epoch'}, $co{'committer_tz'});
1040 if (defined $co{'parent'}) {
1041 open my $fd, "-|", "$gitbin/git-diff-tree -r " . $co{'parent'} . " $hash" || die_error(undef, "Open failed.");
1042 @difftree = map { chomp; $_ } <$fd>;
1043 close $fd || die_error(undef, "Reading diff-tree failed.");
1045 # fake git-diff-tree output for initial revision
1046 open my $fd, "-|", "$gitbin/git-ls-tree -r $hash" || die_error(undef, "Open failed.");
1047 @difftree = map { chomp; "+" . $_ } <$fd>;
1048 close $fd || die_error(undef, "Reading ls-tree failed.");
1051 print "<div class=\"page_nav\">\n" .
1052 $cgi->a({-href => "$my_uri?p=$project;a=log"}, "log") .
1053 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash"}, "commit");
1054 if (defined $co{'parent'}) {
1055 print " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash"}, "commitdiff");
1057 print " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=" . $co{'tree'} . ";hb=$hash"}, "tree") . "\n" .
1058 "<br/><br/></div>\n";
1059 if (defined $co{'parent'}) {
1061 $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash", -class => "title"}, escapeHTML($co{'title'})) . "\n" .
1065 $cgi->a({-href => "$my_uri?p=$project;a=tree;h=" . $co{'tree'} . ";hb=$hash", -class => "title"}, escapeHTML($co{'title'})) . "\n" .
1068 print "<div class=\"title_text\">\n" .
1069 "<table cellspacing=\"0\">\n";
1070 print "<tr><td>author</td><td>" . escapeHTML($co{'author'}) . "</td></tr>\n".
1071 "<tr><td></td><td> " . $ad{'rfc2822'};
1072 if ($ad{'hour_local'} < 6) {
1073 printf(" (<span style=\"color: #cc0000;\">%02d:%02d</span> %s)", $ad{'hour_local'}, $ad{'minute_local'}, $ad{'tz_local'});
1075 printf(" (%02d:%02d %s)", $ad{'hour_local'}, $ad{'minute_local'}, $ad{'tz_local'});
1077 print "</td></tr>\n";
1078 print "<tr><td>committer</td><td>" . escapeHTML($co{'committer'}) . "</td></tr>\n";
1079 print "<tr><td></td><td> " . $cd{'rfc2822'} . sprintf(" (%02d:%02d %s)", $cd{'hour_local'}, $cd{'minute_local'}, $cd{'tz_local'}) . "</td></tr>\n";
1080 print "<tr><td>commit</td><td style=\"font-family: monospace;\">$hash</td></tr>\n";
1081 print "<tr><td>tree</td><td style=\"font-family: monospace;\">" .
1082 $cgi->a({-href => "$my_uri?p=$project;a=tree;h=" . $co{'tree'} . ";hb=" . $hash}, $co{'tree'}) . "</td></tr>\n";
1083 my $parents = $co{'parents'};
1084 foreach my $par (@$parents) {
1085 print "<tr><td>parent</td><td style=\"font-family: monospace;\">" .
1086 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$par"}, $par) . "</td></tr>\n";
1090 print "<div class=\"page_body\">\n";
1091 my $comment = $co{'comment'};
1094 foreach my $line (@$comment) {
1095 # print only one empty line
1097 if ($empty || $signed) {
1104 if ($line =~ m/^(signed[ \-]off[\-]by[ :]|acked[\-]by[ \:]|cc[ :])/i) {
1106 print "<span style=\"color: #888888\">" . escapeHTML($line) . "</span><br/>\n";
1109 print escapeHTML($line) . "<br/>\n";
1113 print "<div class=\"list_head\">\n";
1114 if ($#difftree > 10) {
1115 print(($#difftree + 1) . " files changed:\n");
1118 foreach my $line (@difftree) {
1119 # '*100644->100644 blob 9f91a116d91926df3ba936a80f020a6ab1084d2b->bb90a0c3a91eb52020d0db0e8b4f94d30e02d596 net/ipv4/route.c'
1120 # '+100644 blob 4a83ab6cd565d21ab0385bac6643826b83c2fcd4 arch/arm/lib/bitops.h'
1121 # '*100664->100644 blob b1a8e3dd5556b61dd771d32307c6ee5d7150fa43->b1a8e3dd5556b61dd771d32307c6ee5d7150fa43 show-files.c'
1122 # '*100664->100644 blob d08e895238bac36d8220586fdc28c27e1a7a76d3->d08e895238bac36d8220586fdc28c27e1a7a76d3 update-cache.c'
1123 $line =~ m/^(.)(.*)\t(.*)\t(.*)\t(.*)$/;
1129 if ($type eq "blob") {
1132 if (S_ISREG(oct $mode)) {
1133 $mode_chng = sprintf(" with mode: %04o", (oct $mode) & 0777);
1135 print "<div class=\"list\">\n" .
1136 $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$id;hb=$hash;f=$file"},
1137 escapeHTML($file) . " <span style=\"color: #008000;\">[new " . file_type($mode) . $mode_chng . "]</span>") . "\n" .
1139 print "<div class=\"list_link\">\n" .
1140 $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$id;hb=$hash;f=$file"}, "blob") . "\n" .
1142 } elsif ($op eq "-") {
1143 print "<div class=\"list\">\n" .
1144 $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$id;hb=$hash;f=$file"},
1145 escapeHTML($file) . " <span style=\"color: #c00000;\">[deleted " . file_type($mode) . "]</span>") . "\n" .
1147 print "<div class=\"list_link\">\n" .
1148 $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$id;hb=$hash;f=$file"}, "blob") . " | " .
1149 $cgi->a({-href => "$my_uri?p=$project;a=history;h=$hash;f=$file"}, "history") . "\n" .
1151 } elsif ($op eq "*") {
1152 $id =~ m/([0-9a-fA-F]+)->([0-9a-fA-F]+)/;
1155 $mode =~ m/^([0-7]{6})->([0-7]{6})$/;
1158 my $mode_chnge = "";
1159 if ($from_mode != $to_mode) {
1160 $mode_chnge = " <span style=\"color: #777777;\">[changed";
1161 if (((oct $from_mode) & S_IFMT) != ((oct $to_mode) & S_IFMT)) {
1162 $mode_chnge .= " from " . file_type($from_mode) . " to " . file_type($to_mode);
1164 if (((oct $from_mode) & 0777) != ((oct $to_mode) & 0777)) {
1165 if (S_ISREG($from_mode) && S_ISREG($to_mode)) {
1166 $mode_chnge .= sprintf(" mode: %04o->%04o", (oct $from_mode) & 0777, (oct $to_mode) & 0777);
1167 } elsif (S_ISREG($to_mode)) {
1168 $mode_chnge .= sprintf(" mode: %04o", (oct $to_mode) & 0777);
1171 $mode_chnge .= "]</span>\n";
1173 print "<div class=\"list\">\n";
1174 if ($to_id ne $from_id) {
1175 print $cgi->a({-href => "$my_uri?p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$file"},
1176 escapeHTML($file) . $mode_chnge) . "\n" .
1179 print $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file"},
1180 escapeHTML($file) . $mode_chnge) . "\n" .
1183 print "<div class=\"list_link\">\n";
1184 if ($to_id ne $from_id) {
1185 print $cgi->a({-href => "$my_uri?p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$file"}, "diff") . " | ";
1187 print $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file"}, "blob") . " | " .
1188 $cgi->a({-href => "$my_uri?p=$project;a=history;h=$hash;f=$file"}, "history") . "\n" .
1197 mkdir($gittmp, 0700);
1199 if (defined $hash_base && (my %co = git_read_commit($hash_base))) {
1200 print "<div class=\"page_nav\">\n" .
1201 $cgi->a({-href => "$my_uri?p=$project;a=log"}, "log") .
1202 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash_base"}, "commit") .
1203 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash_base"}, "commitdiff") .
1204 " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=" . $co{'tree'} . ";hb=$hash_base"}, "tree");
1205 if (defined $file_name) {
1206 print " | " . $cgi->a({-href => "$my_uri?p=$project;a=history;h=$hash_base;f=$file_name"}, "history");
1208 print "<br/><br/>\n" .
1211 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash_base", -class => "title"}, escapeHTML($co{'title'})) . "\n" .
1214 print "<div class=\"page_nav\">\n" .
1215 "<br/><br/></div>\n" .
1216 "<div class=\"title\">$hash vs $hash_parent</div>\n";
1218 if (defined $file_name) {
1219 print "<div class=\"page_path\">\n" .
1223 print "<div class=\"page_body\">\n" .
1224 "<div class=\"diff_info\">blob:" .
1225 $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$hash_parent;hb=$hash_base;f=$file_name"}, $hash_parent) .
1227 $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$hash;hb=$hash_base;f=$file_name"}, $hash) .
1229 git_diff_html($hash_parent, $file_name || $hash_parent, $hash, $file_name || $hash);
1234 sub git_commitdiff {
1235 mkdir($gittmp, 0700);
1236 my %co = git_read_commit($hash);
1238 die_error(undef, "Unknown commit object.");
1240 open my $fd, "-|", "$gitbin/git-diff-tree -r " . $co{'parent'} . " $hash" || die_error(undef, "Open failed.");
1241 my (@difftree) = map { chomp; $_ } <$fd>;
1242 close $fd || die_error(undef, "Reading diff-tree failed.");
1245 print "<div class=\"page_nav\">\n" .
1246 $cgi->a({-href => "$my_uri?p=$project;a=log"}, "log") .
1247 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash"}, "commit") .
1248 " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash"}, "commitdiff") .
1249 " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=" . $co{'tree'} . ";hb=$hash"}, "tree") .
1250 "<br/><br/></div>\n";
1252 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash", -class => "title"}, escapeHTML($co{'title'})) . "\n" .
1254 print "<div class=\"page_body\">\n";
1255 foreach my $line (@difftree) {
1256 # '*100644->100644 blob 8e5f9bbdf4de94a1bc4b4da8cb06677ce0a57716->8da3a306d0c0c070d87048d14a033df02f40a154 Makefile'
1257 $line =~ m/^(.)(.*)\t(.*)\t(.*)\t(.*)$/;
1263 if ($type eq "blob") {
1265 print "<div class=\"diff_info\">" . file_type($mode) . ":" .
1266 $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$id;hb=$hash;f=$file"}, $id) . "(new)" .
1268 git_diff_html(undef, "/dev/null", $id, "b/$file");
1269 } elsif ($op eq "-") {
1270 print "<div class=\"diff_info\">" . file_type($mode) . ":" .
1271 $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$id;hb=$hash;f=$file"}, $id) . "(deleted)" .
1273 git_diff_html($id, "a/$file", undef, "/dev/null");
1274 } elsif ($op eq "*") {
1275 $id =~ m/([0-9a-fA-F]+)->([0-9a-fA-F]+)/;
1278 $mode =~ m/([0-7]+)->([0-7]+)/;
1281 if ($from_id ne $to_id) {
1282 print "<div class=\"diff_info\">" .
1283 file_type($from_mode) . ":" . $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$from_id;hb=$hash;f=$file"}, $from_id) .
1285 file_type($to_mode) . ":" . $cgi->a({-href => "$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file"}, $to_id);
1287 git_diff_html($from_id, "a/$file", $to_id, "b/$file");
1298 if (!defined $hash) {
1299 $hash = git_read_hash("$project/HEAD");
1301 my %co = git_read_commit($hash);
1303 die_error(undef, "Unknown commit object.");
1306 print "<div class=\"page_nav\">\n" .
1307 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash"}, "commit") . " | " .
1308 $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash"}, "commitdiff") . " | " .
1309 $cgi->a({-href => "$my_uri?p=$project;a=tree;h=" . $co{'tree'} . ";hb=$hash"}, "tree") .
1313 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash", -class => "title"}, escapeHTML($co{'title'})) . "\n" .
1315 print "<div class=\"page_path\">\n" .
1316 "/$file_name<br/>\n";
1318 open my $fd, "-|", "$gitbin/git-rev-list $hash | $gitbin/git-diff-tree -r --stdin $file_name";
1320 while (my $line = <$fd>) {
1321 if ($line =~ m/^([0-9a-fA-F]{40}) /){
1325 if ($line =~ m/^(.)(.*)\t(.*)\t(.*)\t(.*)$/ && (defined $commit)) {
1328 if ($file ne $file_name || $type ne "blob") {
1331 my %co = git_read_commit($commit);
1335 print "<div class=\"list\">\n" .
1336 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"},
1337 "<span class=\"log_age\">" . $co{'age_string'} . "</span>" . escapeHTML($co{'title'})) . "\n" .
1339 print "<div class=\"list_link\">\n" .
1340 $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"}, "commit") .
1341 " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=" . $co{'tree'} . ";hb=$commit"}, "tree") .
1342 " | " . $cgi->a({-href => "$my_uri?p=$project;a=blob;hb=$commit;f=" . $file}, "blob");
1343 my $blob = git_get_hash_by_path($hash, $file_name);
1344 my $blob_parent = git_get_hash_by_path($commit, $file_name);
1345 if (defined $blob && defined $blob_parent && $blob ne $blob_parent) {
1346 print " | " . $cgi->a({-href => "$my_uri?p=$project;a=blobdiff;h=$blob;hp=$blob_parent;hb=$commit;f=" . $file}, "diff");