Commit 6ea87c47f0f8a24ae031c3fff17bc913889ecd00

Authored by Cedric Gatay
1 parent 8c40aab1

Incorrect line numbering in diff

When displaying a diff, the line number always starts at one, even if the first diff is not at the first line
Fixes this to display correct line numbering on first diff
Showing 1 changed file with 2 additions and 2 deletions   Show diff stats
app/helpers/commits_helper.rb
... ... @@ -61,12 +61,12 @@ module CommitsHelper
61 61 full_line = html_escape(line.gsub(/\n/, '')).force_encoding("UTF-8")
62 62  
63 63 if line.match(/^@@ -/)
64   - next if line_old == 1 && line_new == 1
65 64 type = "match"
66 65  
67 66 line_old = line.match(/\-[0-9]*/)[0].to_i.abs rescue 0
68 67 line_new = line.match(/\+[0-9]*/)[0].to_i.abs rescue 0
69   -
  68 +
  69 + next if line_old == 1 && line_new == 1
70 70 yield(line, type, nil, nil, nil)
71 71 next
72 72 else
... ...