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
99d39133
Commit
99d39133
authored
Sep 25, 2012
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a "patch" MIME type, and render it like a normal view in Commit#show
parent
c058e390
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
22 deletions
+17
-22
app/controllers/commit_controller.rb
app/controllers/commit_controller.rb
+14
-11
app/controllers/commits_controller.rb
app/controllers/commits_controller.rb
+0
-11
app/views/commit/show.patch.erb
app/views/commit/show.patch.erb
+1
-0
config/initializers/mime_types.rb
config/initializers/mime_types.rb
+2
-0
No files found.
app/controllers/commit_controller.rb
View file @
99d39133
...
@@ -15,19 +15,22 @@ class CommitController < ApplicationController
...
@@ -15,19 +15,22 @@ class CommitController < ApplicationController
result
=
CommitLoad
.
new
(
project
,
current_user
,
params
).
execute
result
=
CommitLoad
.
new
(
project
,
current_user
,
params
).
execute
@commit
=
result
[
:commit
]
@commit
=
result
[
:commit
]
git_not_found!
unless
@commit
if
@commit
@suppress_diff
=
result
[
:suppress_diff
]
@suppress_diff
=
result
[
:suppress_diff
]
@note
=
result
[
:note
]
@note
=
result
[
:note
]
@line_notes
=
result
[
:line_notes
]
@line_notes
=
result
[
:line_notes
]
@notes_count
=
result
[
:notes_count
]
@notes_count
=
result
[
:notes_count
]
@comments_allowed
=
true
@comments_allowed
=
true
else
return
git_not_found!
end
respond_to
do
|
format
|
format
.
html
do
if
result
[
:status
]
==
:huge_commit
if
result
[
:status
]
==
:huge_commit
render
"huge_commit"
and
return
render
"huge_commit"
and
return
end
end
end
end
format
.
patch
end
end
end
end
app/controllers/commits_controller.rb
View file @
99d39133
...
@@ -25,15 +25,4 @@ class CommitsController < ApplicationController
...
@@ -25,15 +25,4 @@ class CommitsController < ApplicationController
format
.
atom
{
render
layout:
false
}
format
.
atom
{
render
layout:
false
}
end
end
end
end
def
patch
@commit
=
project
.
commit
(
params
[
:id
])
send_data
(
@commit
.
to_patch
,
type:
"text/plain"
,
disposition:
'attachment'
,
filename:
"
#{
@commit
.
id
}
.patch"
)
end
end
end
app/views/commit/show.patch.erb
0 → 100644
View file @
99d39133
<%=
@commit
.
to_patch
%>
config/initializers/mime_types.rb
View file @
99d39133
...
@@ -3,3 +3,5 @@
...
@@ -3,3 +3,5 @@
# Add new mime types for use in respond_to blocks:
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
# Mime::Type.register_alias "text/html", :iphone
Mime
::
Type
.
register_alias
'text/plain'
,
:patch
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