Commit 810d0903f8b8639a6429483a290cbf0fe5a67776
Exists in
master
and in
4 other branches
Merge branch 'diff_bug'
Showing
1 changed file
with
2 additions
and
3 deletions
Show diff stats
lib/gitlab/inline_diff.rb
| ... | ... | @@ -21,14 +21,13 @@ module Gitlab |
| 21 | 21 | end |
| 22 | 22 | end |
| 23 | 23 | first_token = first_line[0..first_the_same_symbols][1..-1] |
| 24 | - | |
| 25 | 24 | diff_arr[index+1].sub!(first_token, first_token + START) |
| 26 | 25 | diff_arr[index+2].sub!(first_token, first_token + START) |
| 27 | - | |
| 28 | 26 | last_the_same_symbols = 0 |
| 29 | 27 | (1..max_length + 1).each do |i| |
| 30 | 28 | last_the_same_symbols = -i |
| 31 | - if first_line[-i] != second_line[-i] | |
| 29 | + shortest_line = second_line.size > first_line.size ? first_line : second_line | |
| 30 | + if ( first_line[-i] != second_line[-i] ) || "#{first_token}#{START}".size == shortest_line[1..-i].size | |
| 32 | 31 | break |
| 33 | 32 | end |
| 34 | 33 | end | ... | ... |