Merge branch 'ce-avoid_es_loading_commits' into 'master'
Backport of avoid_es_loading_commits See merge request gitlab-org/gitlab-ce!26301
This commit is contained in:
commit
9266901e50
1 changed files with 8 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue