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
Kazuhiko Shiozaki
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
Show 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 @@
...
@@ -17,14 +17,14 @@
-
diffs
.
each_with_index
do
|
diff
,
i
|
-
diffs
.
each_with_index
do
|
diff
,
i
|
-
next
if
diff
.
diff
.
empty?
-
next
if
diff
.
diff
.
empty?
-
file
=
Tree
.
new
(
@repository
,
@commit
.
id
,
@ref
,
diff
.
new_path
)
-
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
-
next
unless
file
.file
{
id:
"diff-#{i}"
}
.file
{
id:
"diff-#{i}"
}
.header
.header
-
if
diff
.
deleted_file
-
if
diff
.
deleted_file
%span
=
diff
.
old_path
%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
=
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 @
View file @
%span
.commit-short-id
=
@commit
.
short_id
(
6
)
%span
.commit-short-id
=
@commit
.
short_id
(
6
)
...
@@ -43,7 +43,7 @@
...
@@ -43,7 +43,7 @@
-
if
file
.
text?
-
if
file
.
text?
=
render
"commits/text_file"
,
diff:
diff
,
index:
i
=
render
"commits/text_file"
,
diff:
diff
,
index:
i
-
elsif
file
.
image?
-
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
=
render
"commits/image"
,
diff:
diff
,
old_file:
old_file
,
file:
file
,
index:
i
-
else
-
else
%p
.nothing_here_message
No preview for this file type
%p
.nothing_here_message
No preview for this file type
lib/gitlab/git/commit.rb
View file @
0c5795a4
...
@@ -5,8 +5,8 @@ module Gitlab
...
@@ -5,8 +5,8 @@ module Gitlab
module
Git
module
Git
class
Commit
class
Commit
attr_accessor
:raw_commit
,
:head
,
:refs
,
attr_accessor
:raw_commit
,
:head
,
:refs
,
:
sha
,
:authored_date
,
:committed_date
,
:message
,
:
id
,
:authored_date
,
:committed_date
,
:message
,
:author_name
,
:author_email
,
:author_name
,
:author_email
,
:parent_ids
,
:committer_name
,
:committer_email
:committer_name
,
:committer_email
delegate
:parents
,
:diffs
,
:tree
,
:stats
,
:to_patch
,
delegate
:parents
,
:diffs
,
:tree
,
:stats
,
:to_patch
,
...
@@ -14,7 +14,7 @@ module Gitlab
...
@@ -14,7 +14,7 @@ module Gitlab
class
<<
self
class
<<
self
def
serialize_keys
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
end
def
find_or_first
(
repo
,
commit_id
=
nil
,
root_ref
)
def
find_or_first
(
repo
,
commit_id
=
nil
,
root_ref
)
...
@@ -88,8 +88,8 @@ module Gitlab
...
@@ -88,8 +88,8 @@ module Gitlab
@head
=
head
@head
=
head
end
end
def
id
def
sha
sha
id
end
end
def
short_id
(
length
=
10
)
def
short_id
(
length
=
10
)
...
@@ -109,16 +109,8 @@ module Gitlab
...
@@ -109,16 +109,8 @@ module Gitlab
author_name
!=
committer_name
||
author_email
!=
committer_email
author_name
!=
committer_name
||
author_email
!=
committer_email
end
end
def
prev_commit
def
parent_id
@prev_commit
||=
if
parents
.
present?
parent_ids
.
first
Commit
.
new
(
parents
.
first
)
else
nil
end
end
def
prev_commit_id
prev_commit
.
try
:id
end
end
# Shows the diff between the commit's parent and the commit.
# Shows the diff between the commit's parent and the commit.
...
@@ -164,7 +156,7 @@ module Gitlab
...
@@ -164,7 +156,7 @@ module Gitlab
def
init_from_grit
(
grit
)
def
init_from_grit
(
grit
)
@raw_commit
=
grit
@raw_commit
=
grit
@
sha
=
grit
.
sha
@
id
=
grit
.
id
@message
=
grit
.
message
@message
=
grit
.
message
@authored_date
=
grit
.
authored_date
@authored_date
=
grit
.
authored_date
@committed_date
=
grit
.
committed_date
@committed_date
=
grit
.
committed_date
...
@@ -172,6 +164,7 @@ module Gitlab
...
@@ -172,6 +164,7 @@ module Gitlab
@author_email
=
grit
.
author
.
email
@author_email
=
grit
.
author
.
email
@committer_name
=
grit
.
committer
.
name
@committer_name
=
grit
.
committer
.
name
@committer_email
=
grit
.
committer
.
email
@committer_email
=
grit
.
committer
.
email
@parent_ids
=
grit
.
parents
.
map
(
&
:id
)
end
end
def
init_from_hash
(
hash
)
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