Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
0c5795a4
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0c5795a4
编写于
4月 02, 2013
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
serialize parent_ids in commit
上级
5f4445c3
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
12 addition
and
19 deletion
+12
-19
app/views/commits/_diffs.html.haml
app/views/commits/_diffs.html.haml
+3
-3
lib/gitlab/git/commit.rb
lib/gitlab/git/commit.rb
+9
-16
未找到文件。
app/views/commits/_diffs.html.haml
浏览文件 @
0c5795a4
...
...
@@ -17,14 +17,14 @@
-
diffs
.
each_with_index
do
|
diff
,
i
|
-
next
if
diff
.
diff
.
empty?
-
file
=
Tree
.
new
(
@repository
,
@commit
.
id
,
@ref
,
diff
.
new_path
)
-
file
=
(
@commit
.
prev_commit
.
tree
/
diff
.
old_path
)
unless
file
-
file
=
Tree
.
new
(
@repository
,
@commit
.
parent_id
,
@ref
,
diff
.
old_path
)
unless
file
-
next
unless
file
.file
{
id:
"diff-#{i}"
}
.header
-
if
diff
.
deleted_file
%span
=
diff
.
old_path
-
if
@commit
.
p
rev_commit
-
if
@commit
.
p
arent_ids
.
present?
=
link_to
project_tree_path
(
@project
,
tree_join
(
@commit
.
prev_commit_id
,
diff
.
new_path
)),
{
:class
=>
'btn btn-tiny pull-right view-file'
}
do
View file @
%span
.commit-short-id
=
@commit
.
short_id
(
6
)
...
...
@@ -43,7 +43,7 @@
-
if
file
.
text?
=
render
"commits/text_file"
,
diff:
diff
,
index:
i
-
elsif
file
.
image?
-
old_file
=
(
@commit
.
prev_commit
.
tree
/
diff
.
old_path
)
if
!
@commit
.
prev_commit
.
nil?
-
old_file
=
Tree
.
new
(
@repository
,
@commit
.
parent_id
,
@ref
,
diff
.
old_path
)
if
@commit
.
parent_id
=
render
"commits/image"
,
diff:
diff
,
old_file:
old_file
,
file:
file
,
index:
i
-
else
%p
.nothing_here_message
No preview for this file type
lib/gitlab/git/commit.rb
浏览文件 @
0c5795a4
...
...
@@ -5,8 +5,8 @@ module Gitlab
module
Git
class
Commit
attr_accessor
:raw_commit
,
:head
,
:refs
,
:
sha
,
:authored_date
,
:committed_date
,
:message
,
:author_name
,
:author_email
,
:
id
,
:authored_date
,
:committed_date
,
:message
,
:author_name
,
:author_email
,
:parent_ids
,
:committer_name
,
:committer_email
delegate
:parents
,
:diffs
,
:tree
,
:stats
,
:to_patch
,
...
...
@@ -14,7 +14,7 @@ module Gitlab
class
<<
self
def
serialize_keys
%w(
sha authored_date committed_date author_name author_email committer_name committer_email message
)
%w(
id authored_date committed_date author_name author_email committer_name committer_email message parent_ids
)
end
def
find_or_first
(
repo
,
commit_id
=
nil
,
root_ref
)
...
...
@@ -88,8 +88,8 @@ module Gitlab
@head
=
head
end
def
id
sha
def
sha
id
end
def
short_id
(
length
=
10
)
...
...
@@ -109,16 +109,8 @@ module Gitlab
author_name
!=
committer_name
||
author_email
!=
committer_email
end
def
prev_commit
@prev_commit
||=
if
parents
.
present?
Commit
.
new
(
parents
.
first
)
else
nil
end
end
def
prev_commit_id
prev_commit
.
try
:id
def
parent_id
parent_ids
.
first
end
# Shows the diff between the commit's parent and the commit.
...
...
@@ -164,7 +156,7 @@ module Gitlab
def
init_from_grit
(
grit
)
@raw_commit
=
grit
@
sha
=
grit
.
sha
@
id
=
grit
.
id
@message
=
grit
.
message
@authored_date
=
grit
.
authored_date
@committed_date
=
grit
.
committed_date
...
...
@@ -172,6 +164,7 @@ module Gitlab
@author_email
=
grit
.
author
.
email
@committer_name
=
grit
.
committer
.
name
@committer_email
=
grit
.
committer
.
email
@parent_ids
=
grit
.
parents
.
map
(
&
:id
)
end
def
init_from_hash
(
hash
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录