diff options
-rw-r--r-- | app/models/merge_request_diff.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb index afa3611d044..36b8b70870b 100644 --- a/app/models/merge_request_diff.rb +++ b/app/models/merge_request_diff.rb @@ -30,6 +30,10 @@ class MergeRequestDiff < ActiveRecord::Base select(column_names - ['st_diffs']) end + def st_commits + super || [] + end + # Collect information about commits and diff from repository # and save it to the database as serialized data def save_git_content @@ -83,7 +87,7 @@ class MergeRequestDiff < ActiveRecord::Base end def commits - @commits ||= load_commits(st_commits || []) + @commits ||= load_commits(st_commits) end def reload_commits @@ -120,10 +124,8 @@ class MergeRequestDiff < ActiveRecord::Base def commits_sha if @commits commits.map(&:sha) - elsif st_commits - st_commits.map { |commit| commit[:id] } else - [] + st_commits.map { |commit| commit[:id] } end end |