Commit 335f9d64105fc887e74b22922da58b2edb1bc809
1 parent
df6b587f
Exists in
master
and in
4 other branches
New Feature: Diff patch file export for commit
Showing
4 changed files
with
28 additions
and
1 deletions
Show diff stats
app/controllers/commits_controller.rb
... | ... | @@ -64,4 +64,15 @@ class CommitsController < ApplicationController |
64 | 64 | @commit = Commit.new(older) |
65 | 65 | end |
66 | 66 | end |
67 | + | |
68 | + def patch | |
69 | + @commit = project.commit(params[:id]) | |
70 | + | |
71 | + send_data( | |
72 | + @commit.to_patch, | |
73 | + :type => "text/plain", | |
74 | + :disposition => 'attachment', | |
75 | + :filename => (@commit.id.to_s + ".patch") | |
76 | + ) | |
77 | + end | |
67 | 78 | end | ... | ... |
app/models/commit.rb
app/views/commits/_commit_box.html.haml
1 | 1 | .commit-box{class: @commit.parents.count > 1 ? "merge-commit" : ""} |
2 | 2 | .commit-head |
3 | - = link_to "Browse Code »", tree_project_ref_path(@project, @commit.id), :class => "browse-button" | |
3 | + .right | |
4 | + = link_to tree_project_ref_path(@project, @commit.id), :class => "browse-button primary" do | |
5 | + %strong Browse Code » | |
6 | + - if @notes_count > 0 | |
7 | + %span.btn.disabled | |
8 | + %i.icon-comment | |
9 | + = @notes_count | |
10 | + | |
11 | + = link_to patch_project_commit_path(@project, @commit.id), :class => "btn small" do | |
12 | + %i.icon-download-alt | |
13 | + Get Patch | |
14 | + | |
4 | 15 | %h3.commit-title |
5 | 16 | = commit_msg_with_link_to_issues(@project, @commit.title) |
6 | 17 | - if @commit.description.present? | ... | ... |