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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
26323046
Commit
26323046
authored
Mar 31, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Decorate Gitlab::Git::Commit with Commit
parent
9dc64463
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
3 deletions
+13
-3
app/contexts/commit_load_context.rb
app/contexts/commit_load_context.rb
+1
-0
app/controllers/commits_controller.rb
app/controllers/commits_controller.rb
+1
-0
app/models/commit.rb
app/models/commit.rb
+8
-0
lib/gitlab/git/commit.rb
lib/gitlab/git/commit.rb
+2
-2
spec/helpers/gitlab_markdown_helper_spec.rb
spec/helpers/gitlab_markdown_helper_spec.rb
+1
-1
No files found.
app/contexts/commit_load_context.rb
View file @
26323046
...
@@ -12,6 +12,7 @@ class CommitLoadContext < BaseContext
...
@@ -12,6 +12,7 @@ class CommitLoadContext < BaseContext
commit
=
project
.
repository
.
commit
(
params
[
:id
])
commit
=
project
.
repository
.
commit
(
params
[
:id
])
if
commit
if
commit
commit
=
Commit
.
new
(
commit
)
commit
=
CommitDecorator
.
decorate
(
commit
)
commit
=
CommitDecorator
.
decorate
(
commit
)
line_notes
=
project
.
notes
.
for_commit_id
(
commit
.
id
).
inline
line_notes
=
project
.
notes
.
for_commit_id
(
commit
.
id
).
inline
...
...
app/controllers/commits_controller.rb
View file @
26323046
...
@@ -13,6 +13,7 @@ class CommitsController < ProjectResourceController
...
@@ -13,6 +13,7 @@ class CommitsController < ProjectResourceController
@limit
,
@offset
=
(
params
[
:limit
]
||
40
),
(
params
[
:offset
]
||
0
)
@limit
,
@offset
=
(
params
[
:limit
]
||
40
),
(
params
[
:offset
]
||
0
)
@commits
=
@repo
.
commits
(
@ref
,
@path
,
@limit
,
@offset
)
@commits
=
@repo
.
commits
(
@ref
,
@path
,
@limit
,
@offset
)
@commits
=
Commit
.
decorate
(
@commits
)
@commits
=
CommitDecorator
.
decorate_collection
(
@commits
)
@commits
=
CommitDecorator
.
decorate_collection
(
@commits
)
respond_to
do
|
format
|
respond_to
do
|
format
|
...
...
app/models/commit.rb
View file @
26323046
...
@@ -10,12 +10,20 @@ class Commit
...
@@ -10,12 +10,20 @@ class Commit
attr_accessor
:raw
attr_accessor
:raw
def
self
.
decorate
(
commits
)
commits
.
map
{
|
c
|
Commit
.
new
(
c
)
}
end
def
initialize
(
raw_commit
)
def
initialize
(
raw_commit
)
raise
"Nil as raw commit passed"
unless
raw_commit
raise
"Nil as raw commit passed"
unless
raw_commit
@raw
=
raw_commit
@raw
=
raw_commit
end
end
def
id
@raw
.
id
end
def
method_missing
(
m
,
*
args
,
&
block
)
def
method_missing
(
m
,
*
args
,
&
block
)
@raw
.
send
(
m
,
*
args
,
&
block
)
@raw
.
send
(
m
,
*
args
,
&
block
)
end
end
...
...
lib/gitlab/git/commit.rb
View file @
26323046
...
@@ -7,8 +7,8 @@ module Gitlab
...
@@ -7,8 +7,8 @@ module Gitlab
attr_accessor
:raw_commit
,
:head
,
:refs
attr_accessor
:raw_commit
,
:head
,
:refs
delegate
:message
,
:authored_date
,
:committed_date
,
:parents
,
:sha
,
delegate
:message
,
:authored_date
,
:committed_date
,
:parents
,
:sha
,
:date
,
:committer
,
:author
,
:diffs
,
:tree
,
:id
,
:stats
,
:date
,
:committer
,
:author
,
:diffs
,
:tree
,
:id
,
:stats
,
:to_patch
,
:to_patch
,
to: :raw_commit
to: :raw_commit
class
<<
self
class
<<
self
def
find_or_first
(
repo
,
commit_id
=
nil
,
root_ref
)
def
find_or_first
(
repo
,
commit_id
=
nil
,
root_ref
)
...
...
spec/helpers/gitlab_markdown_helper_spec.rb
View file @
26323046
...
@@ -7,7 +7,7 @@ describe GitlabMarkdownHelper do
...
@@ -7,7 +7,7 @@ describe GitlabMarkdownHelper do
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
,
username:
'gfm'
)
}
let
(
:user
)
{
create
(
:user
,
username:
'gfm'
)
}
let
(
:commit
)
{
CommitDecorator
.
decorate
(
project
.
repository
.
commit
)
}
let
(
:commit
)
{
CommitDecorator
.
decorate
(
Commit
.
new
(
project
.
repository
.
commit
)
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
project:
project
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
project:
project
)
}
let
(
:snippet
)
{
create
(
:snippet
,
project:
project
)
}
let
(
:snippet
)
{
create
(
:snippet
,
project:
project
)
}
...
...
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