Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
git
提交
d51e902a
G
git
项目概览
李少辉-开发者
/
git
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
git
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d51e902a
编写于
8月 07, 2005
作者:
K
Kay Sievers
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
v057
上级
061cc7cd
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
45 addition
and
9 deletion
+45
-9
gitweb.cgi
gitweb.cgi
+45
-9
未找到文件。
gitweb.cgi
浏览文件 @
d51e902a
...
...
@@ -14,7 +14,7 @@ use CGI::Carp qw(fatalsToBrowser);
my $cgi = new CGI;
my $version = "05
6
";
my $version = "05
7
";
my $projectroot = "/home/kay/public_html/pub/scm";
my $defaultprojects = "linux/kernel/git";
my $gitbin = "/home/kay/bin/git";
...
...
@@ -26,6 +26,7 @@ my $project = $cgi->param('p');
my $action = $cgi->param('a');
my $hash = $cgi->param('h');
my $hash_parent = $cgi->param('hp');
my $file_name = $cgi->param('f');
my $time_back = $cgi->param('t');
$ENV{'SHA1_FILE_DIRECTORY'} = "$projectroot/$project/objects";
...
...
@@ -33,6 +34,9 @@ $ENV{'SHA1_FILE_DIRECTORY'} = "$projectroot/$project/objects";
if (defined($project)
&&
$project =~ /(^|\/)(|\.|\.\.)($|\/)/) {
die_error("", "Invalid project parameter.");
}
if (defined($file_name)
&&
$file_name =~ /(^|\/)(|\.|\.\.)($|\/)/) {
die_error("", "Invalid file parameter.");
}
if (defined($action)
&&
!$action =~ m/^[0-9a-zA-Z\.\-]+$/) {
die_error("", "Invalid action parameter.");
}
...
...
@@ -44,8 +48,6 @@ if (defined($hash_parent) && !($hash_parent =~ m/^[0-9a-fA-F]{40}$/)) {
}
if (defined($time_back)
&&
!($time_back =~ m/^[0-9]+$/)) {
die_error("", "Invalid time parameter.");
} else {
$time_back = 1;
}
sub git_header_html {
...
...
@@ -339,10 +341,14 @@ if ($project eq "") {
exit;
}
if (
$action eq ""
) {
if (
!defined($action)
) {
$action = "log";
}
if (!defined($time_back)) {
$time_back = 1;
}
if ($action eq "blob") {
git_header_html();
print "
<div
class=
\"page_body\"
><pre><br/><br/>
\n";
...
...
@@ -384,7 +390,7 @@ if ($action eq "blob") {
git_footer_html();
} elsif ($action eq "log" || $action eq "rss") {
open my $fd, "-|", "$gitbin/rev-list " . git_head($project);
my (@rev
tree
) = map { chomp; $_ }
<
$
fd
>
;
my (@rev
list
) = map { chomp; $_ }
<
$
fd
>
;
close $fd;
if ($action eq "log") {
...
...
@@ -409,8 +415,8 @@ if ($action eq "blob") {
"
<language>
en
</language>
\n";
}
for (my $i = 0; $i
<
=
$
#rev
tree
;
$
i
++)
{
my
$
commit =
$rev
tree
[$i];
for (my $i = 0; $i
<
=
$
#rev
list
;
$
i
++)
{
my
$
commit =
$rev
list
[$i];
my
%
co =
git_commit($commit);
my
%
ad =
date_str($co{'author_epoch'});
my
$
age =
time
-
$
co
{'
committer_epoch
'};
...
...
@@ -466,7 +472,7 @@ if ($action eq "blob") {
last if ($i >= 20);
print "
<item>
\n" .
"\t
<title>
" . sprintf("%d %s %02d:%02d", $ad{'mday'}, $ad{'month'}, $ad{'hour'}, $ad{'min'}) . " - " . escapeHTML($co{'title'}) . "
</title>
\n" .
"\t
<link>
" . $my_url . "?p=$project;a=
=
commit;h=$commit
</link>
\n" .
"\t
<link>
" . $my_url . "?p=$project;a=commit;h=$commit
</link>
\n" .
"\t
<description>
";
my $comment = $co{'comment'};
foreach my $line (@$comment) {
...
...
@@ -544,7 +550,8 @@ if ($action eq "blob") {
$id =~ m/([0-9a-fA-F]+)->([0-9a-fA-F]+)/;
my $from = $1;
my $to = $2;
print "$modestr " . $cgi->a({-href => "$my_uri?p=$project;a=blobdiff;h=$to;hp=$from"}, $file) . "\n";
print "$modestr " . $cgi->a({-href => "$my_uri?p=$project;a=blobdiff;h=$to;hp=$from"}, $file) . " (" .
$cgi->a({-href => "$my_uri?p=$project;a=filerevision;h=$hash;f=$file"}, "history") . ")\n";
}
}
}
...
...
@@ -595,6 +602,35 @@ if ($action eq "blob") {
print "
<br/></pre>
\n";
print "
</div>
";
git_footer_html();
} elsif ($action eq "filerevision") {
open my $fd, "-|", "$gitbin/rev-list $hash";
my (@revlist) = map { chomp; $_ }
<
$
fd
>
;
close $fd;
git_header_html();
print "
<div
class=
\"page_body\"
>
\n" .
"
<pre>
\n";
foreach my $rev (@revlist) {
my %co = git_commit($rev);
my $parents = $co{'parents'};
foreach my $parent (@$parents) {
open $fd, "-|", "$gitbin/diff-tree -r $parent $rev $file_name";
my (@difftree) = map { chomp; $_ }
<
$
fd
>
;
close $fd;
foreach my $line (@difftree) {
$line =~ m/^(.)(.*)\t(.*)\t(.*)\t(.*)$/;
my $file = $5;
if ($file eq $file_name) {
print $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$rev"}, $rev) . " (" . $co{'title'} .")\n";
last;
}
}
}
}
print "
<br/></pre>
\n";
print "
</div>
";
git_footer_html();
} else {
die_error("", "unknown action");
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录