|
|
@ -15,7 +15,7 @@ use CGI::Carp qw(fatalsToBrowser); |
|
|
|
use Fcntl ':mode'; |
|
|
|
use Fcntl ':mode'; |
|
|
|
|
|
|
|
|
|
|
|
my $cgi = new CGI; |
|
|
|
my $cgi = new CGI; |
|
|
|
my $version = "225"; |
|
|
|
my $version = "227"; |
|
|
|
my $my_url = $cgi->url(); |
|
|
|
my $my_url = $cgi->url(); |
|
|
|
my $my_uri = $cgi->url(-absolute => 1); |
|
|
|
my $my_uri = $cgi->url(-absolute => 1); |
|
|
|
my $rss_link = ""; |
|
|
|
my $rss_link = ""; |
|
|
@ -53,8 +53,6 @@ if (defined $action) { |
|
|
|
git_opml(); |
|
|
|
git_opml(); |
|
|
|
exit; |
|
|
|
exit; |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
|
|
|
|
$action = "summary"; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
my $project = $cgi->param('p'); |
|
|
|
my $project = $cgi->param('p'); |
|
|
@ -76,7 +74,7 @@ if (defined $project) { |
|
|
|
die_error(undef, "No such project."); |
|
|
|
die_error(undef, "No such project."); |
|
|
|
} |
|
|
|
} |
|
|
|
$rss_link = "<link rel=\"alternate\" title=\"$project log\" href=\"$my_uri?p=$project;a=rss\" type=\"application/rss+xml\"/>"; |
|
|
|
$rss_link = "<link rel=\"alternate\" title=\"$project log\" href=\"$my_uri?p=$project;a=rss\" type=\"application/rss+xml\"/>"; |
|
|
|
$ENV{'GIT_OBJECT_DIRECTORY'} = "$projectroot/$project/objects"; |
|
|
|
$ENV{'GIT_DIR'} = "$projectroot/$project"; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
git_project_list(); |
|
|
|
git_project_list(); |
|
|
|
exit; |
|
|
|
exit; |
|
|
@ -95,9 +93,15 @@ if (defined $file_name) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
my $hash = $cgi->param('h'); |
|
|
|
my $hash = $cgi->param('h'); |
|
|
|
if (defined $hash && !($hash =~ m/^[0-9a-fA-F]{40}$/)) { |
|
|
|
if (defined $hash) { |
|
|
|
undef $hash; |
|
|
|
if ($hash =~ m/(^|\/)(|\.|\.\.)($|\/)/) { |
|
|
|
die_error(undef, "Invalid hash parameter."); |
|
|
|
undef $hash; |
|
|
|
|
|
|
|
die_error(undef, "Non-canonical hash parameter."); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ($hash =~ m/[^a-zA-Z0-9_\.\/\-\+\#\~\:\!]/) { |
|
|
|
|
|
|
|
undef $hash; |
|
|
|
|
|
|
|
die_error(undef, "Invalid character in hash parameter."); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
my $hash_parent = $cgi->param('hp'); |
|
|
|
my $hash_parent = $cgi->param('hp'); |
|
|
@ -120,7 +124,6 @@ if (defined $page) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $searchtext = $cgi->param('s'); |
|
|
|
my $searchtext = $cgi->param('s'); |
|
|
|
if (defined $searchtext) { |
|
|
|
if (defined $searchtext) { |
|
|
|
if ($searchtext =~ m/[^a-zA-Z0-9_\.\/\-\+\:\@ ]/) { |
|
|
|
if ($searchtext =~ m/[^a-zA-Z0-9_\.\/\-\+\:\@ ]/) { |
|
|
@ -130,7 +133,7 @@ if (defined $searchtext) { |
|
|
|
$searchtext = quotemeta $searchtext; |
|
|
|
$searchtext = quotemeta $searchtext; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($action eq "summary") { |
|
|
|
if (!defined $action || $action eq "summary") { |
|
|
|
git_summary(); |
|
|
|
git_summary(); |
|
|
|
exit; |
|
|
|
exit; |
|
|
|
} elsif ($action eq "branches") { |
|
|
|
} elsif ($action eq "branches") { |
|
|
@ -722,7 +725,7 @@ sub git_project_list { |
|
|
|
if (!defined $head) { |
|
|
|
if (!defined $head) { |
|
|
|
next; |
|
|
|
next; |
|
|
|
} |
|
|
|
} |
|
|
|
$ENV{'GIT_OBJECT_DIRECTORY'} = "$projectroot/$proj{'path'}/objects"; |
|
|
|
$ENV{'GIT_DIR'} = "$projectroot/$proj{'path'}"; |
|
|
|
my %co = git_read_commit($head); |
|
|
|
my %co = git_read_commit($head); |
|
|
|
if (!%co) { |
|
|
|
if (!%co) { |
|
|
|
next; |
|
|
|
next; |
|
|
@ -766,8 +769,23 @@ sub git_read_refs { |
|
|
|
my $ref_dir = shift; |
|
|
|
my $ref_dir = shift; |
|
|
|
my @reflist; |
|
|
|
my @reflist; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my @refs; |
|
|
|
opendir my $dh, "$projectroot/$project/$ref_dir"; |
|
|
|
opendir my $dh, "$projectroot/$project/$ref_dir"; |
|
|
|
my @refs = grep !m/^\./, readdir $dh; |
|
|
|
while (my $dir = readdir($dh)) { |
|
|
|
|
|
|
|
if ($dir =~ m/^\./) { |
|
|
|
|
|
|
|
next; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (-d "$projectroot/$project/$ref_dir/$dir") { |
|
|
|
|
|
|
|
opendir my $dh2, "$projectroot/$project/$ref_dir/$dir"; |
|
|
|
|
|
|
|
my @subdirs = grep !m/^\./, readdir $dh2; |
|
|
|
|
|
|
|
closedir($dh2); |
|
|
|
|
|
|
|
foreach my $subdir (@subdirs) { |
|
|
|
|
|
|
|
push @refs, "$dir/$subdir" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
next; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
push @refs, $dir; |
|
|
|
|
|
|
|
} |
|
|
|
closedir($dh); |
|
|
|
closedir($dh); |
|
|
|
foreach my $ref_file (@refs) { |
|
|
|
foreach my $ref_file (@refs) { |
|
|
|
my $ref_id = git_read_hash("$project/$ref_dir/$ref_file"); |
|
|
|
my $ref_id = git_read_hash("$project/$ref_dir/$ref_file"); |
|
|
@ -897,14 +915,14 @@ sub git_summary { |
|
|
|
if ($i-- > 0) { |
|
|
|
if ($i-- > 0) { |
|
|
|
print "<td><i>$tag{'age'}</i></td>\n" . |
|
|
|
print "<td><i>$tag{'age'}</i></td>\n" . |
|
|
|
"<td>" . |
|
|
|
"<td>" . |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=$tag{'type'};h=$tag{'id'}", -class => "list"}, "<b>" . |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=$tag{'type'};h=$tag{'name'}", -class => "list"}, "<b>" . |
|
|
|
escapeHTML($tag{'name'}) . "</b>") . |
|
|
|
escapeHTML($tag{'name'}) . "</b>") . |
|
|
|
"</td>\n" . |
|
|
|
"</td>\n" . |
|
|
|
"<td class=\"link\">" . |
|
|
|
"<td class=\"link\">" . |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=$tag{'type'};h=$tag{'id'}"}, $tag{'type'}); |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=$tag{'type'};h=$tag{'name'}"}, $tag{'type'}); |
|
|
|
if ($tag{'type'} eq "commit") { |
|
|
|
if ($tag{'type'} eq "commit") { |
|
|
|
print " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'id'}"}, "shortlog") . |
|
|
|
print " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'name'}"}, "shortlog") . |
|
|
|
" | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'id'}"}, "log"); |
|
|
|
" | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'name'}"}, "log"); |
|
|
|
} |
|
|
|
} |
|
|
|
print "</td>\n" . |
|
|
|
print "</td>\n" . |
|
|
|
"</tr>"; |
|
|
|
"</tr>"; |
|
|
@ -936,12 +954,12 @@ sub git_summary { |
|
|
|
if ($i-- > 0) { |
|
|
|
if ($i-- > 0) { |
|
|
|
print "<td><i>$tag{'age'}</i></td>\n" . |
|
|
|
print "<td><i>$tag{'age'}</i></td>\n" . |
|
|
|
"<td>" . |
|
|
|
"<td>" . |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'id'}", -class => "list"}, |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'name'}", -class => "list"}, |
|
|
|
"<b>" . escapeHTML($tag{'name'}) . "</b>") . |
|
|
|
"<b>" . escapeHTML($tag{'name'}) . "</b>") . |
|
|
|
"</td>\n" . |
|
|
|
"</td>\n" . |
|
|
|
"<td class=\"link\">" . |
|
|
|
"<td class=\"link\">" . |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'id'}"}, "shortlog") . |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'name'}"}, "shortlog") . |
|
|
|
" | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'id'}"}, "log") . |
|
|
|
" | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'name'}"}, "log") . |
|
|
|
"</td>\n" . |
|
|
|
"</td>\n" . |
|
|
|
"</tr>"; |
|
|
|
"</tr>"; |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -984,14 +1002,14 @@ sub git_tags { |
|
|
|
$alternate ^= 1; |
|
|
|
$alternate ^= 1; |
|
|
|
print "<td><i>$tag{'age'}</i></td>\n" . |
|
|
|
print "<td><i>$tag{'age'}</i></td>\n" . |
|
|
|
"<td>" . |
|
|
|
"<td>" . |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'id'}", -class => "list"}, |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'name'}", -class => "list"}, |
|
|
|
"<b>" . escapeHTML($tag{'name'}) . "</b>") . |
|
|
|
"<b>" . escapeHTML($tag{'name'}) . "</b>") . |
|
|
|
"</td>\n" . |
|
|
|
"</td>\n" . |
|
|
|
"<td class=\"link\">" . |
|
|
|
"<td class=\"link\">" . |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=$tag{'type'};h=$tag{'id'}"}, $tag{'type'}); |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=$tag{'type'};h=$tag{'name'}"}, $tag{'type'}); |
|
|
|
if ($tag{'type'} eq "commit") { |
|
|
|
if ($tag{'type'} eq "commit") { |
|
|
|
print " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'id'}"}, "shortlog") . |
|
|
|
print " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'name'}"}, "shortlog") . |
|
|
|
" | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'id'}"}, "log"); |
|
|
|
" | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'name'}"}, "log"); |
|
|
|
} |
|
|
|
} |
|
|
|
print "</td>\n" . |
|
|
|
print "</td>\n" . |
|
|
|
"</tr>"; |
|
|
|
"</tr>"; |
|
|
@ -1030,11 +1048,11 @@ sub git_branches { |
|
|
|
$alternate ^= 1; |
|
|
|
$alternate ^= 1; |
|
|
|
print "<td><i>$tag{'age'}</i></td>\n" . |
|
|
|
print "<td><i>$tag{'age'}</i></td>\n" . |
|
|
|
"<td>" . |
|
|
|
"<td>" . |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'id'}", -class => "list"}, "<b>" . escapeHTML($tag{'name'}) . "</b>") . |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'name'}", -class => "list"}, "<b>" . escapeHTML($tag{'name'}) . "</b>") . |
|
|
|
"</td>\n" . |
|
|
|
"</td>\n" . |
|
|
|
"<td class=\"link\">" . |
|
|
|
"<td class=\"link\">" . |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'id'}"}, "shortog") . |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'name'}"}, "shortlog") . |
|
|
|
" | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'id'}"}, "log") . |
|
|
|
" | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'name'}"}, "log") . |
|
|
|
"</td>\n" . |
|
|
|
"</td>\n" . |
|
|
|
"</tr>"; |
|
|
|
"</tr>"; |
|
|
|
} |
|
|
|
} |
|
|
@ -1270,7 +1288,7 @@ sub git_opml { |
|
|
|
if (!defined $head) { |
|
|
|
if (!defined $head) { |
|
|
|
next; |
|
|
|
next; |
|
|
|
} |
|
|
|
} |
|
|
|
$ENV{'GIT_OBJECT_DIRECTORY'} = "$projectroot/$proj{'path'}/objects"; |
|
|
|
$ENV{'GIT_DIR'} = "$projectroot/$proj{'path'}"; |
|
|
|
my %co = git_read_commit($head); |
|
|
|
my %co = git_read_commit($head); |
|
|
|
if (!%co) { |
|
|
|
if (!%co) { |
|
|
|
next; |
|
|
|
next; |
|
|
|