So that st_commits could never be nil
This commit is contained in:
parent
6987ec29b0
commit
4ed23a3a57
1 changed files with 6 additions and 4 deletions
|
@ -30,6 +30,10 @@ class MergeRequestDiff < ActiveRecord::Base
|
||||||
select(column_names - ['st_diffs'])
|
select(column_names - ['st_diffs'])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def st_commits
|
||||||
|
super || []
|
||||||
|
end
|
||||||
|
|
||||||
# Collect information about commits and diff from repository
|
# Collect information about commits and diff from repository
|
||||||
# and save it to the database as serialized data
|
# and save it to the database as serialized data
|
||||||
def save_git_content
|
def save_git_content
|
||||||
|
@ -83,7 +87,7 @@ class MergeRequestDiff < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def commits
|
def commits
|
||||||
@commits ||= load_commits(st_commits || [])
|
@commits ||= load_commits(st_commits)
|
||||||
end
|
end
|
||||||
|
|
||||||
def reload_commits
|
def reload_commits
|
||||||
|
@ -120,10 +124,8 @@ class MergeRequestDiff < ActiveRecord::Base
|
||||||
def commits_sha
|
def commits_sha
|
||||||
if @commits
|
if @commits
|
||||||
commits.map(&:sha)
|
commits.map(&:sha)
|
||||||
elsif st_commits
|
|
||||||
st_commits.map { |commit| commit[:id] }
|
|
||||||
else
|
else
|
||||||
[]
|
st_commits.map { |commit| commit[:id] }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue