Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
git
提交
991910a9
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,发现更多精彩内容 >>
提交
991910a9
编写于
8月 07, 2005
作者:
K
Kay Sievers
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
v042
上级
86eed32d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
32 addition
and
28 deletion
+32
-28
gitweb.pl
gitweb.pl
+32
-28
未找到文件。
gitweb.pl
浏览文件 @
991910a9
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
# gitweb.pl - simple web interface to track changes in git repositories
# gitweb.pl - simple web interface to track changes in git repositories
#
#
# Version 04
1
# Version 04
2
#
#
# (C) 2005, Kay Sievers <kay.sievers@vrfy.org>
# (C) 2005, Kay Sievers <kay.sievers@vrfy.org>
# (C) 2005, Christian Gierke <ch@gierke.de>
# (C) 2005, Christian Gierke <ch@gierke.de>
...
@@ -127,16 +127,16 @@ sub git_commit {
...
@@ -127,16 +127,16 @@ sub git_commit {
push
@parents
,
$
1
;
push
@parents
,
$
1
;
}
elsif
(
$line
=~
m/^author (.*) ([0-9]+) (.*)$/
)
{
}
elsif
(
$line
=~
m/^author (.*) ([0-9]+) (.*)$/
)
{
$co
{'
author
'}
=
$
1
;
$co
{'
author
'}
=
$
1
;
$co
{'
author_time_
utc
'}
=
$
2
;
$co
{'
author_time_
epoch
'}
=
$
2
;
$co
{'
author_timezone
'}
=
$
3
;
$co
{'
author_timezone
'}
=
$
3
;
$co
{'
author_
timezone
'}
=~
m/((-|\+)[0-9][0-9])([0-9][0-9])/
;
$co
{'
author_
name
'}
=
$co
{'
author
'}
;
$co
{'
author_
time_local
'}
=
$co
{'
author_time_utc
'}
+
((
$
1
+
(
$
2
/
60
))
*
3600
)
;
$co
{'
author_
name
'}
=~
s/ <.*//
;
}
elsif
(
$line
=~
m/^committer (.*) ([0-9]+) (.*)$/
)
{
}
elsif
(
$line
=~
m/^committer (.*) ([0-9]+) (.*)$/
)
{
$co
{'
committer
'}
=
$
1
;
$co
{'
committer
'}
=
$
1
;
$co
{'
committer_time_
utc
'}
=
$
2
;
$co
{'
committer_time_
epoch
'}
=
$
2
;
$co
{'
committer_timezone
'}
=
$
3
;
$co
{'
committer_timezone
'}
=
$
3
;
$co
{'
committer_
timezone
'}
=~
m/((-|\+)[0-9][0-9])([0-9][0-9])/
;
$co
{'
committer_
name
'}
=
$co
{'
committer
'}
;
$co
{'
committer_
time_local
'}
=
$co
{'
committer_time_utc
'}
+
((
$
1
+
(
$
2
/
60
))
*
3600
)
;
$co
{'
committer_
name
'}
=~
s/ <.*//
;
}
}
}
}
$co
{'
parents
'}
=
\
@parents
;
$co
{'
parents
'}
=
\
@parents
;
...
@@ -216,13 +216,13 @@ sub git_diff_html {
...
@@ -216,13 +216,13 @@ sub git_diff_html {
}
}
}
}
# git cares only about the executable bit
sub
mode_str
{
sub
mode_str
{
my
$perms
=
oct
shift
;
my
$perms
=
oct
shift
;
my
$modestr
;
my
$modestr
;
if
(
$perms
&
040000
)
{
if
(
$perms
&
040000
)
{
$modestr
.=
'
drwxrwxr-x
';
$modestr
.=
'
drwxrwxr-x
';
}
else
{
}
else
{
# git cares only about the executable bit
if
(
$perms
&
0100
)
{
if
(
$perms
&
0100
)
{
$modestr
.=
'
-rwxrwxr-x
';
$modestr
.=
'
-rwxrwxr-x
';
}
else
{
}
else
{
...
@@ -233,17 +233,22 @@ sub mode_str {
...
@@ -233,17 +233,22 @@ sub mode_str {
}
}
sub
date_str
{
sub
date_str
{
my
$
date_utc
=
shift
;
my
$
epoch
=
shift
;
my
$
format
=
shift
||
"
date-time
";
my
$
tz
=
shift
||
"
-0000
";
my
%date
;
my
@months
=
("
Jan
",
"
Feb
",
"
Mar
",
"
Apr
",
"
May
",
"
Jun
",
"
Jul
",
"
Aug
",
"
Sep
",
"
Oct
",
"
Nov
",
"
Dec
");
my
@months
=
("
Jan
",
"
Feb
",
"
Mar
",
"
Apr
",
"
May
",
"
Jun
",
"
Jul
",
"
Aug
",
"
Sep
",
"
Oct
",
"
Nov
",
"
Dec
");
my
@days
=
("
Sun
",
"
Mon
",
"
Tue
",
"
Wed
",
"
Thu
",
"
Fri
",
"
Sat
");
my
@days
=
("
Sun
",
"
Mon
",
"
Tue
",
"
Wed
",
"
Thu
",
"
Fri
",
"
Sat
");
my
(
$sec
,
$min
,
$hour
,
$mday
,
$mon
,
$year
,
$wday
,
$yday
)
=
gmtime
(
$date_utc
);
my
(
$sec
,
$min
,
$hour
,
$mday
,
$mon
,
$year
,
$wday
,
$yday
)
=
gmtime
(
$epoch
);
if
(
$format
eq
"
date-time
")
{
$date
{'
hour
'}
=
$hour
;
return
sprintf
"
%s, %d %s %4d %02d:%02d:%02d
",
$days
[
$wday
],
$mday
,
$months
[
$mon
],
1900
+
$year
,
$hour
,
$min
,
$sec
;
$date
{'
rfc2822
'}
=
sprintf
"
%s, %d %s %4d %02d:%02d:%02d +0000
",
$days
[
$wday
],
$mday
,
$months
[
$mon
],
1900
+
$year
,
$hour
,
$min
,
$sec
;
}
elsif
(
$format
eq
"
day-time
")
{
$date
{'
mday-time
'}
=
sprintf
"
%d %s %02d:%02d
",
$mday
,
$months
[
$mon
],
$hour
,
$min
;
return
sprintf
"
%d %s %02d:%02d
",
$mday
,
$months
[
$mon
],
$hour
,
$min
;
}
$tz
=~
m/((-|\+)[0-9][0-9])([0-9][0-9])/
;
my
$local
=
$epoch
+
((
$
1
+
(
$
2
/
60
))
*
3600
);
(
$sec
,
$min
,
$hour
,
$mday
,
$mon
,
$year
,
$wday
,
$yday
)
=
gmtime
(
$local
);
$date
{'
rfc2822_local
'}
=
sprintf
"
%s, %d %s %4d %02d:%02d:%02d %s
",
$days
[
$wday
],
$mday
,
$months
[
$mon
],
1900
+
$year
,
$hour
,
$min
,
$sec
,
$tz
;
return
%date
;
}
}
if
(
$action
eq
"
git-logo.png
")
{
if
(
$action
eq
"
git-logo.png
")
{
...
@@ -353,7 +358,8 @@ sub date_str {
...
@@ -353,7 +358,8 @@ sub date_str {
for
(
my
$i
=
0
;
$i
<=
$#revtree
;
$i
++
)
{
for
(
my
$i
=
0
;
$i
<=
$#revtree
;
$i
++
)
{
my
$commit
=
$revtree
[
$i
];
my
$commit
=
$revtree
[
$i
];
my
%co
=
git_commit
(
$commit
);
my
%co
=
git_commit
(
$commit
);
my
$age
=
time
-
$co
{'
committer_time_utc
'};
my
%ad
=
date_str
(
$co
{'
author_time_epoch
'});
my
$age
=
time
-
$co
{'
committer_time_epoch
'};
my
$age_string
;
my
$age_string
;
if
(
$age
>
60
*
60
*
24
*
365
*
2
)
{
if
(
$age
>
60
*
60
*
24
*
365
*
2
)
{
$age_string
=
int
$age
/60/
60
/24/
365
;
$age_string
=
int
$age
/60/
60
/24/
365
;
...
@@ -393,8 +399,7 @@ sub date_str {
...
@@ -393,8 +399,7 @@ sub date_str {
print
$cgi
->
a
({
-
href
=>
"
$my_uri
?p=
$project
;a=commitdiff;h=
$commit
"},
"
view diff
")
.
"
<br/>
\n
";
print
$cgi
->
a
({
-
href
=>
"
$my_uri
?p=
$project
;a=commitdiff;h=
$commit
"},
"
view diff
")
.
"
<br/>
\n
";
print
"
</td>
\n
";
print
"
</td>
\n
";
print
"
<td class=
\"
head2
\"
>
\n
";
print
"
<td class=
\"
head2
\"
>
\n
";
print
"
author
"
.
escapeHTML
(
$co
{'
author
'})
.
"
[
"
.
date_str
(
$co
{'
author_time_utc
'})
.
"
]<br/>
\n
";
print
escapeHTML
(
$co
{'
author_name
'})
.
"
[
"
.
$ad
{'
rfc2822
'}
.
"
]<br/>
\n
";
print
"
committer
"
.
escapeHTML
(
$co
{'
committer
'})
.
"
[
"
.
date_str
(
$co
{'
committer_time_utc
'})
.
"
]<br/>
\n
";
print
"
</td>
";
print
"
</td>
";
print
"
</tr>
\n
";
print
"
</tr>
\n
";
print
"
<tr>
\n
";
print
"
<tr>
\n
";
...
@@ -413,7 +418,7 @@ sub date_str {
...
@@ -413,7 +418,7 @@ sub date_str {
print
"
</tr>
\n
";
print
"
</tr>
\n
";
}
elsif
(
$action
eq
"
rss
")
{
}
elsif
(
$action
eq
"
rss
")
{
last
if
(
$i
>=
20
);
last
if
(
$i
>=
20
);
print
"
<item>
\n\t
<title>
"
.
date_str
(
$co
{'
author_time_utc
'},
"
day-time
")
.
"
-
"
.
escapeHTML
(
$co
{'
title
'})
.
"
</title>
\n
";
print
"
<item>
\n\t
<title>
"
.
$ad
{'
mday-time
'}
.
"
-
"
.
escapeHTML
(
$co
{'
title
'})
.
"
</title>
\n
";
print
"
\t
<link>
"
.
$my_url
.
"
/
$project
/commit/
$commit
</link>
\n
";
print
"
\t
<link>
"
.
$my_url
.
"
/
$project
/commit/
$commit
</link>
\n
";
print
"
\t
<description>
";
print
"
\t
<description>
";
my
$comment
=
$co
{'
comment
'};
my
$comment
=
$co
{'
comment
'};
...
@@ -432,6 +437,8 @@ sub date_str {
...
@@ -432,6 +437,8 @@ sub date_str {
}
}
}
elsif
(
$action
eq
"
commit
")
{
}
elsif
(
$action
eq
"
commit
")
{
my
%co
=
git_commit
(
$hash
);
my
%co
=
git_commit
(
$hash
);
my
%ad
=
date_str
(
$co
{'
author_time_epoch
'},
$co
{'
author_time_zone
'});
my
%cd
=
date_str
(
$co
{'
committer_time_epoch
'},
$co
{'
committer_time_zone
'});
open
my
$fd
,
"
-|
",
"
$gitbin
/diff-tree
",
"
-r
",
$co
{'
parent
'},
$hash
;
open
my
$fd
,
"
-|
",
"
$gitbin
/diff-tree
",
"
-r
",
$co
{'
parent
'},
$hash
;
my
(
@difftree
)
=
map
{
chomp
;
$_
}
<
$fd
>
;
my
(
@difftree
)
=
map
{
chomp
;
$_
}
<
$fd
>
;
close
$fd
;
close
$fd
;
...
@@ -445,14 +452,11 @@ sub date_str {
...
@@ -445,14 +452,11 @@ sub date_str {
print
"
<table cellspacing=
\"
0
\"
class=
\"
log
\"
>
\n
";
print
"
<table cellspacing=
\"
0
\"
class=
\"
log
\"
>
\n
";
print
"
<tr>
\n
";
print
"
<tr>
\n
";
print
"
<td class=
\"
head2
\"
>
";
print
"
<td class=
\"
head2
\"
>
";
print
"
author
"
.
escapeHTML
(
$co
{'
author
'})
.
"
[
"
.
date_str
(
$co
{'
author_time_utc
'})
.
"
]<br/>
\n
";
print
"
author
"
.
escapeHTML
(
$co
{'
author
'})
.
"
[
"
.
$ad
{'
rfc2822
'}
.
"
]<br/>
\n
";
if
(
$ad
{'
hour
'}
<
7
)
{
print
"
<span style=
\"
color: #990000;
\"
>
";
}
my
(
$sec
,
$min
,
$hour
,
$mday
,
$mon
,
$year
,
$wday
,
$yday
)
=
gmtime
(
$co
{'
author_time_local
'});
print
"
localtime
"
.
$ad
{'
rfc2822_local
'}
.
"
<br/>
\n
";
if
(
$hour
<
7
)
{
print
"
<span style=
\"
color: #990000;
\"
>
";
}
if
(
$ad
{'
hour
'}
<
7
)
{
print
"
</span>
";
}
print
"
localtime
"
.
date_str
(
$co
{'
author_time_local
'})
.
"
"
.
$co
{'
author_timezone
'}
.
"
<br/>
\n
";
print
"
committer
"
.
escapeHTML
(
$co
{'
committer
'})
.
"
[
"
.
$cd
{'
rfc2822
'}
.
"
]<br/>
\n
";
if
(
$hour
<
7
)
{
print
"
</span>
";
}
print
"
committer
"
.
escapeHTML
(
$co
{'
committer
'})
.
"
[
"
.
date_str
(
$co
{'
committer_time_utc
'})
.
"
]<br/>
\n
";
print
"
localtime
"
.
date_str
(
$co
{'
committer_time_local
'})
.
"
"
.
$co
{'
committer_timezone
'}
.
"
<br/>
\n
";
print
"
commit
$hash
<br/>
\n
";
print
"
commit
$hash
<br/>
\n
";
print
"
tree
"
.
$cgi
->
a
({
-
href
=>
"
$my_uri
?p=
$project
;a=tree;h=
$co
{'tree'}
"},
$co
{'
tree
'})
.
"
<br/>
\n
";
print
"
tree
"
.
$cgi
->
a
({
-
href
=>
"
$my_uri
?p=
$project
;a=tree;h=
$co
{'tree'}
"},
$co
{'
tree
'})
.
"
<br/>
\n
";
my
$parents
=
$co
{'
parents
'};
my
$parents
=
$co
{'
parents
'};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录