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
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
@repository = repository
@head = head
@lazy_load_parents = lazy_load_parents
init_commit(raw_commit)
end
......@@ -225,6 +226,12 @@ module Gitlab
author_name != committer_name || author_email != committer_email
end
def parent_ids
return @parent_ids unless @lazy_load_parents
@parent_ids ||= @repository.commit(id).parent_ids
end
def parent_id
parent_ids.first
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