Commit 8f52501eb579923a86f94efac8286f8897faec93
1 parent
5d092945
Exists in
master
and in
4 other branches
Fix inline diff issue. See #3150
Showing
2 changed files
with
4 additions
and
5 deletions
Show diff stats
app/controllers/commit_controller.rb
| @@ -11,7 +11,7 @@ class CommitController < ProjectResourceController | @@ -11,7 +11,7 @@ class CommitController < ProjectResourceController | ||
| 11 | result = CommitLoadContext.new(project, current_user, params).execute | 11 | result = CommitLoadContext.new(project, current_user, params).execute |
| 12 | 12 | ||
| 13 | @commit = result[:commit] | 13 | @commit = result[:commit] |
| 14 | - | 14 | + |
| 15 | if @commit.nil? | 15 | if @commit.nil? |
| 16 | git_not_found! | 16 | git_not_found! |
| 17 | return | 17 | return |
lib/gitlab/inline_diff.rb
| @@ -21,8 +21,9 @@ module Gitlab | @@ -21,8 +21,9 @@ module Gitlab | ||
| 21 | end | 21 | end |
| 22 | end | 22 | end |
| 23 | first_token = first_line[0..first_the_same_symbols][1..-1] | 23 | first_token = first_line[0..first_the_same_symbols][1..-1] |
| 24 | - diff_arr[index+1].sub!(first_token, first_token + START) | ||
| 25 | - diff_arr[index+2].sub!(first_token, first_token + START) | 24 | + start = first_token + START |
| 25 | + diff_arr[index+1].sub!(first_token, first_token => start) | ||
| 26 | + diff_arr[index+2].sub!(first_token, first_token => start) | ||
| 26 | last_the_same_symbols = 0 | 27 | last_the_same_symbols = 0 |
| 27 | (1..max_length + 1).each do |i| | 28 | (1..max_length + 1).each do |i| |
| 28 | last_the_same_symbols = -i | 29 | last_the_same_symbols = -i |
| @@ -60,8 +61,6 @@ module Gitlab | @@ -60,8 +61,6 @@ module Gitlab | ||
| 60 | line.gsub!(FINISH, "</span>") | 61 | line.gsub!(FINISH, "</span>") |
| 61 | line | 62 | line |
| 62 | end | 63 | end |
| 63 | - | ||
| 64 | end | 64 | end |
| 65 | - | ||
| 66 | end | 65 | end |
| 67 | end | 66 | end |