|
| 1 | +# frozen-string-literal: true |
| 2 | + |
1 | 3 | class Commit < ApplicationRecord |
2 | 4 | has_many :contributions, dependent: :destroy |
3 | 5 | has_many :contributors, through: :contributions |
@@ -43,13 +45,13 @@ def self.import!(rugged_commit) |
43 | 45 | def self.new_from_rugged_commit(rugged_commit) |
44 | 46 | new( |
45 | 47 | sha1: rugged_commit.oid, |
46 | | - author_name: rugged_commit.author[:name].force_encoding('UTF-8'), |
47 | | - author_email: rugged_commit.author[:email].force_encoding('UTF-8'), |
| 48 | + author_name: rugged_commit.author[:name].dup.force_encoding('UTF-8'), |
| 49 | + author_email: rugged_commit.author[:email].dup.force_encoding('UTF-8'), |
48 | 50 | author_date: rugged_commit.author[:time], |
49 | | - committer_name: rugged_commit.committer[:name].force_encoding('UTF-8'), |
50 | | - committer_email: rugged_commit.committer[:email].force_encoding('UTF-8'), |
| 51 | + committer_name: rugged_commit.committer[:name].dup.force_encoding('UTF-8'), |
| 52 | + committer_email: rugged_commit.committer[:email].dup.force_encoding('UTF-8'), |
51 | 53 | committer_date: rugged_commit.committer[:time], |
52 | | - message: rugged_commit.message.force_encoding('UTF-8'), |
| 54 | + message: rugged_commit.message.dup.force_encoding('UTF-8'), |
53 | 55 | merge: rugged_commit.parents.size > 1 |
54 | 56 | ) |
55 | 57 | end |
@@ -196,7 +198,7 @@ def cache_diff(repo) |
196 | 198 | # git show, and is an expensive operation. So, we do this only for those |
197 | 199 | # commits where this is needed, and cache the result in the database. |
198 | 200 | def extract_changelog |
199 | | - changelog = '' |
| 201 | + changelog = +'' |
200 | 202 | in_changelog = false |
201 | 203 | diff.each_line do |line| |
202 | 204 | if line =~ /^diff --git/ |
|
0 commit comments