- print "\211\120\116\107\015\012\032\012\000\000\000\015\111\110\104\122".
- "\000\000\000\110\000\000\000\033\004\003\000\000\000\055\331\324".
- "\055\000\000\000\030\120\114\124\105\377\377\377\140\140\135\260".
- "\257\252\000\200\000\316\315\307\300\000\000\350\350\346\367\367".
- "\366\225\014\247\107\000\000\000\163\111\104\101\124\050\317\143".
- "\110\147\040\004\112\134\030\012\010\052\142\123\141\040\002\010".
- "\015\151\105\254\241\241\001\060\014\223\140\066\046\122\221\261".
- "\001\021\326\341\125\144\154\154\314\154\154\014\242\014\160\052".
- "\142\006\052\301\142\035\263\001\002\123\244\010\350\000\003\030".
- "\046\126\021\324\341\040\227\033\340\264\016\065\044\161\051\202".
- "\231\060\270\223\012\021\271\105\210\301\215\240\242\104\041\006".
- "\047\101\202\100\205\301\105\211\040\160\001\000\244\075\041\305".
- "\022\034\232\376\000\000\000\000\111\105\116\104\256\102\140\202";
- exit;
+ # cat git-logo.png | hexdump -e '16/1 " %02x" "\n"' | sed 's/ /\\x/g'
+ print "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52" .
+ "\x00\x00\x00\x48\x00\x00\x00\x1b\x04\x03\x00\x00\x00\x2d\xd9\xd4" .
+ "\x2d\x00\x00\x00\x18\x50\x4c\x54\x45\xff\xff\xff\x60\x60\x5d\xb0" .
+ "\xaf\xaa\x00\x80\x00\xce\xcd\xc7\xc0\x00\x00\xe8\xe8\xe6\xf7\xf7" .
+ "\xf6\x95\x0c\xa7\x47\x00\x00\x00\x73\x49\x44\x41\x54\x28\xcf\x63" .
+ "\x48\x67\x20\x04\x4a\x5c\x18\x0a\x08\x2a\x62\x53\x61\x20\x02\x08" .
+ "\x0d\x69\x45\xac\xa1\xa1\x01\x30\x0c\x93\x60\x36\x26\x52\x91\xb1" .
+ "\x01\x11\xd6\xe1\x55\x64\x6c\x6c\xcc\x6c\x6c\x0c\xa2\x0c\x70\x2a" .
+ "\x62\x06\x2a\xc1\x62\x1d\xb3\x01\x02\x53\xa4\x08\xe8\x00\x03\x18" .
+ "\x26\x56\x11\xd4\xe1\x20\x97\x1b\xe0\xb4\x0e\x35\x24\x71\x29\x82" .
+ "\x99\x30\xb8\x93\x0a\x11\xb9\x45\x88\xc1\x8d\xa0\xa2\x44\x21\x06" .
+ "\x27\x41\x82\x40\x85\xc1\x45\x89\x20\x70\x01\x00\xa4\x3d\x21\xc5" .
+ "\x12\x1c\x9a\xfe\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82";
+}
+
+sub get_file_owner {
+ my $path = shift;
+
+ my ($dev, $ino, $mode, $nlink, $st_uid, $st_gid, $rdev, $size) = stat($path);
+ my ($name, $passwd, $uid, $gid, $quota, $comment, $gcos, $dir, $shell) = getpwuid($st_uid);
+ if (!defined $gcos) {
+ return undef;
+ }
+ my $owner = $gcos;
+ $owner =~ s/[,;].*$//;
+ return $owner;
+}
+
+sub git_project_list {
+ my @list;
+
+ if (-d $projects_list) {
+ # search in directory
+ my $dir = $projects_list;
+ opendir my $dh, $dir || return undef;
+ while (my $dir = readdir($dh)) {
+ if (-e "$projectroot/$dir/HEAD") {
+ my $pr = {
+ path => $dir,
+ };
+ push @list, $pr
+ }
+ }
+ closedir($dh);
+ } elsif (-f $projects_list) {
+ # read from file:
+ # 'git/git.git:Linus Torvalds'
+ # 'linux/hotplug/udev.git'
+ open my $fd , $projects_list || return undef;
+ while (my $line = <$fd>) {
+ chomp $line;
+ my ($path, $owner) = split ':', $line;
+ if (!defined $path) {
+ next;
+ }
+ if (-e "$projectroot/$path/HEAD") {
+ my $pr = {
+ path => $path,
+ owner => $owner,
+ };
+ push @list, $pr
+ }
+ }
+ close $fd;
+ }
+
+ if (!@list) {
+ die_error(undef, "No project found.");
+ }
+ @list = sort {$a->{'path'} cmp $b->{'path'}} @list;
+
+ git_header_html();
+ if (-f $home_text) {
+ print "<div class=\"index_include\">\n";
+ open (my $fd, $home_text);
+ print <$fd>;
+ close $fd;
+ print "</div>\n";
+ }
+ print "<div class=\"page_body\"><br/>\n" .
+ "<table cellspacing=\"0\">\n" .
+ "<tr>\n" .
+ "<th>Project</th>\n" .
+ "<th>Description</th>\n" .
+ "<th>Owner</th>\n" .
+ "<th>last change</th>\n" .
+ "<th></th>\n" .
+ "</tr>\n";
+ foreach my $pr (@list) {
+ my %proj = %$pr;
+ my $head = git_read_hash("$proj{'path'}/HEAD");
+ if (!defined $head) {
+ next;
+ }
+ $ENV{'GIT_OBJECT_DIRECTORY'} = "$projectroot/$proj{'path'}/objects";
+ $ENV{'SHA1_FILE_DIRECTORY'} = "$projectroot/$proj{'path'}/objects";
+ my %co = git_read_commit($head);
+ if (!%co) {
+ next;
+ }
+ my $descr = git_read_description($proj{'path'}) || "";
+ # get directory owner if not already specified
+ if (!defined $proj{'owner'}) {
+ $proj{'owner'} = get_file_owner("$projectroot/$proj{'path'}") || "";
+ }
+ print "<tr>\n" .
+ "<td>" . $cgi->a({-href => "$my_uri?p=$proj{'path'};a=summary"}, escapeHTML($proj{'path'})) . "</td>\n" .
+ "<td>$descr</td>\n" .
+ "<td><i>$proj{'owner'}</i></td>\n";
+ my $colored_age;
+ if ($co{'age'} < 60*60*2) {
+ $colored_age = "<span style =\"color: #009900;\"><b><i>$co{'age_string'}</i></b></span>";
+ } elsif ($co{'age'} < 60*60*24*2) {
+ $colored_age = "<span style =\"color: #009900;\"><i>$co{'age_string'}</i></span>";
+ } else {
+ $colored_age = "<i>$co{'age_string'}</i>";
+ }
+ print "<td>$colored_age</td>\n" .
+ "<td class=\"link\">" .
+ $cgi->a({-href => "$my_uri?p=$proj{'path'};a=summary"}, "summary") .
+ " | " . $cgi->a({-href => "$my_uri?p=$proj{'path'};a=log"}, "log") .
+ " | " . $cgi->a({-href => "$my_uri?p=$proj{'path'};a=tree"}, "tree") .
+ "</td>\n" .
+ "</tr>\n";
+ }
+ print "</table>\n" .
+ "<br/>\n" .
+ "</div>\n";
+ git_footer_html();