From 6ea87c47f0f8a24ae031c3fff17bc913889ecd00 Mon Sep 17 00:00:00 2001
From: Cedric Gatay <cedric@gatay.fr>
Date: Wed, 22 Feb 2012 16:04:41 +0100
Subject: [PATCH] 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
---
 app/helpers/commits_helper.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb
index 3ed8e8c39..d097c2712 100644
--- a/app/helpers/commits_helper.rb
+++ b/app/helpers/commits_helper.rb
@@ -61,12 +61,12 @@ module CommitsHelper
       full_line = html_escape(line.gsub(/\n/, '')).force_encoding("UTF-8")
 
       if line.match(/^@@ -/)
-        next if line_old == 1 && line_new == 1
         type = "match"
 
         line_old = line.match(/\-[0-9]*/)[0].to_i.abs rescue 0
         line_new = line.match(/\+[0-9]*/)[0].to_i.abs rescue 0
-
+                
+        next if line_old == 1 && line_new == 1
         yield(line, type, nil, nil, nil)
         next
       else
-- 
2.30.9