change logic on line_code

This commit is contained in:
Dmitriy Zaporozhets 2013-01-15 11:12:17 +02:00
parent bda7fe38d0
commit f598cc7897
9 changed files with 54 additions and 21 deletions

View file

@ -9,11 +9,13 @@ module CommitsHelper
end
end
def build_line_anchor(index, line_new, line_old)
"#{index}_#{line_old}_#{line_new}"
def build_line_anchor(diff, line_new, line_old)
"#{hexdigest(diff.new_path)}_#{line_old}_#{line_new}"
end
def each_diff_line(diff_arr, index)
def each_diff_line(diff, index)
diff_arr = diff.diff.lines.to_a
line_old = 1
line_new = 1
type = nil
@ -39,7 +41,7 @@ module CommitsHelper
next
else
type = identification_type(line)
line_code = build_line_anchor(index, line_new, line_old)
line_code = build_line_anchor(diff, line_new, line_old)
yield(full_line, type, line_code, line_new, line_old)
end