Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
0c5795a4
Commit
0c5795a4
authored
Apr 02, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
serialize parent_ids in commit
parent
5f4445c3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
19 deletions
+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
No files found.
app/views/commits/_diffs.html.haml
View file @
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
View file @
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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment