diff options
Diffstat (limited to 'lib/gitlab/git/commit.rb')
-rw-r--r-- | lib/gitlab/git/commit.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/gitlab/git/commit.rb b/lib/gitlab/git/commit.rb index 1086ea45a7a..d899ed3ba25 100644 --- a/lib/gitlab/git/commit.rb +++ b/lib/gitlab/git/commit.rb @@ -28,7 +28,8 @@ module Gitlab SERIALIZE_KEYS = [ :id, :message, :parent_ids, :authored_date, :author_name, :author_email, - :committed_date, :committer_name, :committer_email, :trailers, :referenced_by + :committed_date, :committer_name, :committer_email, + :trailers, :extended_trailers, :referenced_by ].freeze attr_accessor(*SERIALIZE_KEYS) @@ -432,9 +433,17 @@ module Gitlab @committer_email = commit.committer.email.dup @parent_ids = Array(commit.parent_ids) @trailers = commit.trailers.to_h { |t| [t.key, t.value] } + @extended_trailers = parse_commit_trailers(commit.trailers) @referenced_by = Array(commit.referenced_by) end + # Turn the commit trailers into a hash of key: [value, value] arrays + def parse_commit_trailers(trailers) + trailers.each_with_object({}) do |trailer, hash| + (hash[trailer.key] ||= []) << trailer.value + end + end + # Gitaly provides a UNIX timestamp in author.date.seconds, and a timezone # offset in author.timezone. If the latter isn't present, assume UTC. def init_date_from_gitaly(author) |