Commit ef396d08fc9af54f0e2c69da27d64e13064e0dfb
1 parent
65e4ad31
Exists in
master
and in
4 other branches
Fixed encoding issue for diff. Reordered merge request commits
Showing
3 changed files
with
8 additions
and
4 deletions
Show diff stats
app/controllers/merge_requests_controller.rb
... | ... | @@ -49,7 +49,11 @@ class MergeRequestsController < ApplicationController |
49 | 49 | end |
50 | 50 | |
51 | 51 | def commits |
52 | - @commits = @project.repo.commits_between(@merge_request.target_branch, @merge_request.source_branch).map {|c| Commit.new(c)} | |
52 | + @commits = @project.repo. | |
53 | + commits_between(@merge_request.target_branch, @merge_request.source_branch). | |
54 | + map {|c| Commit.new(c)}. | |
55 | + sort_by(&:created_at). | |
56 | + reverse | |
53 | 57 | end |
54 | 58 | |
55 | 59 | def diffs | ... | ... |
app/helpers/commits_helper.rb
... | ... | @@ -58,7 +58,7 @@ module CommitsHelper |
58 | 58 | next if line.match(/^\-\-\- a/) |
59 | 59 | next if line.match(/^\+\+\+ b/) |
60 | 60 | |
61 | - full_line = html_escape(line.gsub(/\n/, '')) | |
61 | + full_line = html_escape(line.gsub(/\n/, '')).force_encoding("UTF-8") | |
62 | 62 | |
63 | 63 | if line.match(/^@@ -/) |
64 | 64 | next if line_old == 1 && line_new == 1 | ... | ... |
app/views/commits/_diffs.html.haml
1 | 1 | .file_stats |
2 | 2 | = render "commits/diff_head", :diffs => diffs |
3 | - | |
3 | + | |
4 | 4 | - diffs.each_with_index do |diff, i| |
5 | 5 | - next if diff.diff.empty? |
6 | 6 | - file = (@commit.tree / diff.b_path) |
... | ... | @@ -16,7 +16,7 @@ |
16 | 16 | %br/ |
17 | 17 | .diff_file_content |
18 | 18 | - if file.text? |
19 | - = render :partial => "commits/text_file", :locals => { :diff => diff, :index => i } | |
19 | + = render "commits/text_file", :diff => diff, :index => i | |
20 | 20 | - elsif file.image? |
21 | 21 | .diff_file_content_image |
22 | 22 | %img{:src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} | ... | ... |