summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e4669df)
raw | patch | inline | side by side (parent: e4669df)
author | Kay Sievers <kay@mam.(none)> | |
Wed, 10 Aug 2005 01:53:09 +0000 (03:53 +0200) | ||
committer | Kay Sievers <kay@mam.(none)> | |
Wed, 10 Aug 2005 01:53:09 +0000 (03:53 +0200) |
gitweb.cgi | patch | blob | history |
diff --git a/gitweb.cgi b/gitweb.cgi
index 973702f094eb9131beae10be6edcfc0735f7b23d..b0b515efbb51264d57c8e77e89df6ee6c7b1e791 100755 (executable)
--- a/gitweb.cgi
+++ b/gitweb.cgi
use Fcntl ':mode';
my $cgi = new CGI;
-my $version = "237";
+my $version = "238";
my $my_url = $cgi->url();
my $my_uri = $cgi->url(-absolute => 1);
my $rss_link = "";
}
}
+my $order = $cgi->param('o');
+if (defined $order) {
+ if ($order =~ m/[^a-zA-Z0-9_]/) {
+ undef $order;
+ die_error(undef, "Invalid order parameter.");
+ }
+}
+
my $project = $cgi->param('p');
if (defined $project) {
if ($project =~ m/(^|\/)(|\.|\.\.)($|\/)/) {
}
print $cgi->a({-href => "$my_uri?p=$project;a=rss", -class => "rss_logo"}, "RSS") . "\n";
} else {
- print $cgi->a({-href => "$my_uri?a=opml", -class => "rss_logo"}, "RSS") . "\n";
+ print $cgi->a({-href => "$my_uri?a=opml", -class => "rss_logo"}, "OPML") . "\n";
}
print "</div>\n" .
"</body>\n" .
sub git_project_list {
my @list = git_read_projects();
+ my @projects;
if (!@list) {
die_error(undef, "No project found.");
}
+ foreach my $pr (@list) {
+ my $head = git_read_hash("$pr->{'path'}/HEAD");
+ if (!defined $head) {
+ next;
+ }
+ $ENV{'GIT_DIR'} = "$projectroot/$pr->{'path'}";
+ my %co = git_read_commit($head);
+ if (!%co) {
+ next;
+ }
+ $pr->{'commit'} = \%co;
+ if (!defined $pr->{'descr'}) {
+ my $descr = git_read_description($pr->{'path'}) || "";
+ $pr->{'descr'} = chop_str($descr, 25, 5);
+ }
+ if (!defined $pr->{'owner'}) {
+ $pr->{'owner'} = get_file_owner("$projectroot/$pr->{'path'}") || "";
+ }
+ push @projects, $pr;
+ }
git_header_html();
if (-f $home_text) {
print "<div class=\"index_include\">\n";
print "</div>\n";
}
print "<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";
+ if (defined($order) && ($order eq "project")) {
+ @projects = sort {$a->{'path'} cmp $b->{'path'}} @projects;
+ print "<th>Project</th>\n";
+ } else {
+ print "<th>" . $cgi->a({-class => "list", -href => "$my_uri?o=project"}, "Project") . "</th>\n";
+ }
+ print "<th>Description</th>\n";
+ if (defined($order) && ($order eq "owner")) {
+ @projects = sort {$a->{'owner'} cmp $b->{'owner'}} @projects;
+ print "<th>Owner</th>\n";
+ } else {
+ print "<th>" . $cgi->a({-class => "list", -href => "$my_uri?o=owner"}, "Owner") . "</th>\n";
+ }
+ if (defined($order) && ($order eq "age")) {
+ @projects = sort {$a->{'commit'}{'age'} <=> $b->{'commit'}{'age'}} @projects;
+ print "<th>last change</th>\n";
+ } else {
+ print "<th>" . $cgi->a({-class => "list", -href => "$my_uri?o=age"}, "last change") . "</th>\n";
+ }
+ print "<th></th>\n" .
"</tr>\n";
my $alternate = 0;
- foreach my $pr (@list) {
- my %proj = %$pr;
- my $head = git_read_hash("$proj{'path'}/HEAD");
- if (!defined $head) {
- next;
- }
- $ENV{'GIT_DIR'} = "$projectroot/$proj{'path'}";
- my %co = git_read_commit($head);
- if (!%co) {
- next;
- }
- my $descr = git_read_description($proj{'path'}) || "";
- $descr = chop_str($descr, 25, 5);
- # get directory owner if not already specified
- if (!defined $proj{'owner'}) {
- $proj{'owner'} = get_file_owner("$projectroot/$proj{'path'}") || "";
- }
+ foreach my $pr (@projects) {
if ($alternate) {
print "<tr class=\"dark\">\n";
} else {
print "<tr class=\"light\">\n";
}
$alternate ^= 1;
- print "<td>" . $cgi->a({-href => "$my_uri?p=$proj{'path'};a=summary", -class => "list"}, escapeHTML($proj{'path'})) . "</td>\n" .
- "<td>$descr</td>\n" .
- "<td><i>" . chop_str($proj{'owner'}, 15) . "</i></td>\n";
+ print "<td>" . $cgi->a({-href => "$my_uri?p=$pr->{'path'};a=summary", -class => "list"}, escapeHTML($pr->{'path'})) . "</td>\n" .
+ "<td>$pr->{'descr'}</td>\n" .
+ "<td><i>" . chop_str($pr->{'owner'}, 15) . "</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>";
+ if ($pr->{'commit'}{'age'} < 60*60*2) {
+ $colored_age = "<span style =\"color: #009900;\"><b><i>$pr->{'commit'}{'age_string'}</i></b></span>";
+ } elsif ($pr->{'commit'}{'age'} < 60*60*24*2) {
+ $colored_age = "<span style =\"color: #009900;\"><i>$pr->{'commit'}{'age_string'}</i></span>";
} else {
- $colored_age = "<i>$co{'age_string'}</i>";
+ $colored_age = "<i>$pr->{'commit'}{'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=shortlog"}, "shortlog") .
- " | " . $cgi->a({-href => "$my_uri?p=$proj{'path'};a=log"}, "log") .
+ $cgi->a({-href => "$my_uri?p=$pr->{'path'};a=summary"}, "summary") .
+ " | " . $cgi->a({-href => "$my_uri?p=$pr->{'path'};a=shortlog"}, "shortlog") .
+ " | " . $cgi->a({-href => "$my_uri?p=$pr->{'path'};a=log"}, "log") .
"</td>\n" .
"</tr>\n";
}