Skip to content

Commit 6ea87c4

Browse files
committed
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
1 parent 8c40aab commit 6ea87c4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/helpers/commits_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ def each_diff_line(diff_arr, index)
6161
full_line = html_escape(line.gsub(/\n/, '')).force_encoding("UTF-8")
6262

6363
if line.match(/^@@ -/)
64-
next if line_old == 1 && line_new == 1
6564
type = "match"
6665

6766
line_old = line.match(/\-[0-9]*/)[0].to_i.abs rescue 0
6867
line_new = line.match(/\+[0-9]*/)[0].to_i.abs rescue 0
69-
68+
69+
next if line_old == 1 && line_new == 1
7070
yield(line, type, nil, nil, nil)
7171
next
7272
else

0 commit comments

Comments
 (0)