mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-11 05:36:07 +10:00
Since version 4.1, notes.line_code means:
{SHA1 hash of file path}_{old line}_{new line}
but the older version means:
{file index of the commit}_{old line}_{new line}
This rake task migrate the above differences.
14 lines
414 B
Ruby
14 lines
414 B
Ruby
desc "GITLAB | Migrate Note LineCode"
|
|
task migrate_note_linecode: :environment do
|
|
Note.inline.each do |note|
|
|
index = note.diff_file_index
|
|
if index =~ /^\d{1,10}$/ # is number. not hash.
|
|
hash = Digest::SHA1.hexdigest(note.noteable.diffs[index.to_i].new_path)
|
|
new_line_code = note.line_code.sub(index, hash)
|
|
note.update_column :line_code, new_line_code
|
|
print '.'
|
|
end
|
|
end
|
|
end
|
|
|