BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
b389247c
Commit
b389247c
authored
Sep 17, 2012
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Commit#show instead of Commits#show to view a single commit
Commits#show (plural) is going to be for showing commit history on a specific path.
parent
a21abce9
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
43 additions
and
31 deletions
+43
-31
commits_controller.rb
app/controllers/commits_controller.rb
+19
-19
static_model.rb
app/roles/static_model.rb
+4
-0
show.html.haml
app/views/commit/show.html.haml
+0
-0
_commit.html.haml
app/views/commits/_commit.html.haml
+3
-4
_commit.html.haml
app/views/events/_commit.html.haml
+1
-1
blame.html.haml
app/views/refs/blame.html.haml
+2
-2
_branch.html.haml
app/views/repositories/_branch.html.haml
+1
-1
markdown.rb
lib/gitlab/markdown.rb
+1
-1
gitlab_flavored_markdown_spec.rb
spec/requests/gitlab_flavored_markdown_spec.rb
+3
-3
project_routing_spec.rb
spec/routing/project_routing_spec.rb
+9
-0
No files found.
app/controllers/commits_controller.rb
View file @
b389247c
...
...
@@ -26,25 +26,25 @@ class CommitsController < ApplicationController
end
end
def
show
result
=
CommitLoad
.
new
(
project
,
current_user
,
params
).
execute
@commit
=
result
[
:commit
]
if
@commit
@suppress_diff
=
result
[
:suppress_diff
]
@note
=
result
[
:note
]
@line_notes
=
result
[
:line_notes
]
@notes_count
=
result
[
:notes_count
]
@comments_allowed
=
true
else
return
git_not_found!
end
if
result
[
:status
]
==
:huge_commit
render
"huge_commit"
and
return
end
end
#
def show
#
result = CommitLoad.new(project, current_user, params).execute
#
@commit = result[:commit]
#
if @commit
#
@suppress_diff = result[:suppress_diff]
#
@note = result[:note]
#
@line_notes = result[:line_notes]
#
@notes_count = result[:notes_count]
#
@comments_allowed = true
#
else
#
return git_not_found!
#
end
#
if result[:status] == :huge_commit
#
render "huge_commit" and return
#
end
#
end
def
compare
result
=
Commit
.
compare
(
project
,
params
[
:from
],
params
[
:to
])
...
...
app/roles/static_model.rb
View file @
b389247c
...
...
@@ -25,6 +25,10 @@ module StaticModel
id
end
def
new_record?
false
end
def
persisted?
false
end
...
...
app/views/commit
s
/show.html.haml
→
app/views/commit/show.html.haml
View file @
b389247c
File moved
app/views/commits/_commit.html.haml
View file @
b389247c
%li
.commit
.browse_code_link_holder
%p
%strong
=
link_to
"Browse Code »"
,
tree_project_ref_path
(
@project
,
commit
.
id
),
class:
"right"
%strong
=
link_to
"Browse Code »"
,
tree_project_ref_path
(
@project
,
commit
),
class:
"right"
%p
=
link_to
commit
.
short_id
(
8
),
project_commit_path
(
@project
,
id:
commit
.
id
),
class:
"commit_short_id"
=
link_to
commit
.
short_id
(
8
),
project_commit_path
(
@project
,
commit
),
class:
"commit_short_id"
%strong
.commit-author-name
=
commit
.
author_name
%span
.dash
–
=
image_tag
gravatar_icon
(
commit
.
author_email
),
class:
"avatar"
,
width:
16
=
link_to_gfm
truncate
(
commit
.
title
,
length:
50
),
project_commit_path
(
@project
,
id:
commit
.
id
),
class:
"row_title"
=
link_to_gfm
truncate
(
commit
.
title
,
length:
50
),
project_commit_path
(
@project
,
commit
.
id
),
class:
"row_title"
%span
.committed_ago
=
time_ago_in_words
(
commit
.
committed_date
)
ago
app/views/events/_commit.html.haml
View file @
b389247c
-
commit
=
CommitDecorator
.
decorate
(
commit
)
%li
.commit
%p
=
link_to
commit
.
short_id
(
8
),
project_commit_path
(
project
,
id:
commit
.
id
),
class:
"commit_short_id"
=
link_to
commit
.
short_id
(
8
),
project_commit_path
(
project
,
commit
),
class:
"commit_short_id"
%span
=
commit
.
author_name
–
=
image_tag
gravatar_icon
(
commit
.
author_email
),
class:
"avatar"
,
width:
16
...
...
app/views/refs/blame.html.haml
View file @
b389247c
...
...
@@ -32,8 +32,8 @@
=
commit
.
author_name
%td
.blame_commit
%code
=
link_to
commit
.
short_id
,
project_commit_path
(
@project
,
id:
commit
.
id
)
=
link_to_gfm
truncate
(
commit
.
title
,
length:
30
),
project_commit_path
(
@project
,
id:
commit
.
id
),
class:
"row_title"
rescue
"--broken encoding"
%code
=
link_to
commit
.
short_id
,
project_commit_path
(
@project
,
commit
)
=
link_to_gfm
truncate
(
commit
.
title
,
length:
30
),
project_commit_path
(
@project
,
commit
),
class:
"row_title"
rescue
"--broken encoding"
%td
.lines
=
preserve
do
%pre
...
...
app/views/repositories/_branch.html.haml
View file @
b389247c
...
...
@@ -7,7 +7,7 @@
-
if
branch
.
name
==
@project
.
root_ref
%span
.label
default
%td
=
link_to
project_commit_path
(
@project
,
id:
commit
.
id
)
do
=
link_to
project_commit_path
(
@project
,
commit
)
do
%code
=
commit
.
short_id
=
image_tag
gravatar_icon
(
commit
.
author_email
),
class:
""
,
width:
16
...
...
lib/gitlab/markdown.rb
View file @
b389247c
...
...
@@ -174,7 +174,7 @@ module Gitlab
def
reference_commit
(
identifier
)
if
commit
=
@project
.
commit
(
identifier
)
link_to
(
identifier
,
project_commit_path
(
@project
,
id:
commit
.
id
),
html_options
.
merge
(
title:
CommitDecorator
.
new
(
commit
).
link_title
,
class:
"gfm gfm-commit
#{
html_options
[
:class
]
}
"
))
link_to
(
identifier
,
project_commit_path
(
@project
,
commit
),
html_options
.
merge
(
title:
CommitDecorator
.
new
(
commit
).
link_title
,
class:
"gfm gfm-commit
#{
html_options
[
:class
]
}
"
))
end
end
end
...
...
spec/requests/gitlab_flavored_markdown_spec.rb
View file @
b389247c
...
...
@@ -49,13 +49,13 @@ describe "Gitlab Flavored Markdown" do
end
it
"should render title in commits#show"
do
visit
project_commit_path
(
project
,
id:
commit
.
id
)
visit
project_commit_path
(
project
,
commit
)
page
.
should
have_link
(
"#
#{
issue
.
id
}
"
)
end
it
"should render description in commits#show"
do
visit
project_commit_path
(
project
,
id:
commit
.
id
)
visit
project_commit_path
(
project
,
commit
)
page
.
should
have_link
(
"@
#{
fred
.
name
}
"
)
end
...
...
@@ -175,7 +175,7 @@ describe "Gitlab Flavored Markdown" do
describe
"for notes"
do
it
"should render in commits#show"
,
js:
true
do
visit
project_commit_path
(
project
,
id:
commit
.
id
)
visit
project_commit_path
(
project
,
commit
)
fill_in
"note_note"
,
with:
"see #
#{
issue
.
id
}
"
click_button
"Add Comment"
...
...
spec/routing/project_routing_spec.rb
View file @
b389247c
...
...
@@ -298,6 +298,14 @@ describe HooksController, "routing" do
end
end
# project_commit GET /:project_id/commit/:id(.:format) commit#show {:id=>/[[:alnum:]]{6,40}/, :project_id=>/[^\/]+/}
describe
CommitController
,
"routing"
do
it
"to #show"
do
get
(
"/gitlabhq/commit/4246fb"
).
should
route_to
(
'commit#show'
,
project_id:
'gitlabhq'
,
id:
'4246fb'
)
get
(
"/gitlabhq/commit/4246fbd13872934f72a8fd0d6fb1317b47b59cb5"
).
should
route_to
(
'commit#show'
,
project_id:
'gitlabhq'
,
id:
'4246fbd13872934f72a8fd0d6fb1317b47b59cb5'
)
end
end
# compare_project_commits GET /:project_id/commits/compare(.:format) commits#compare
# patch_project_commit GET /:project_id/commits/:id/patch(.:format) commits#patch
# project_commits GET /:project_id/commits(.:format) commits#index
...
...
@@ -317,6 +325,7 @@ describe CommitsController, "routing" do
end
it_behaves_like
"RESTful project resources"
do
let
(
:actions
)
{
[
:index
,
:show
]
}
let
(
:controller
)
{
'commits'
}
end
end
...
...
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