Commit e8861516 authored by Mario de la Ossa's avatar Mario de la Ossa

Backport of avoid_es_loading_commits

parent 12818c20
...@@ -184,11 +184,12 @@ module Gitlab ...@@ -184,11 +184,12 @@ module Gitlab
end end
end end
def initialize(repository, raw_commit, head = nil) def initialize(repository, raw_commit, head = nil, lazy_load_parents: false)
raise "Nil as raw commit passed" unless raw_commit raise "Nil as raw commit passed" unless raw_commit
@repository = repository @repository = repository
@head = head @head = head
@lazy_load_parents = lazy_load_parents
init_commit(raw_commit) init_commit(raw_commit)
end end
...@@ -225,6 +226,12 @@ module Gitlab ...@@ -225,6 +226,12 @@ module Gitlab
author_name != committer_name || author_email != committer_email author_name != committer_name || author_email != committer_email
end end
def parent_ids
return @parent_ids unless @lazy_load_parents
@parent_ids ||= @repository.commit(id).parent_ids
end
def parent_id def parent_id
parent_ids.first parent_ids.first
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment