gitlab-org--gitlab-foss/app
Rémy Coutable a41df736a7 Merge branch 'fix-pipeline-for-empty-merge-request-diff' into 'master'
Fix pipeline error when trying to read empty merge request diff

When a user pushed something which resulted an empty merge request diff, `st_commits` would be `nil`. Therefore we also need to check if there exists `st_commits`.

We could tell this from:

``` ruby
def commits
  @commits ||= load_commits(st_commits || [])
end
```

and

``` ruby
def save_commits
  new_attributes = {}

  commits = compare.commits

  if commits.present?
    commits = Commit.decorate(commits, merge_request.source_project).reverse
    new_attributes[:st_commits] = dump_commits(commits)
  end

  update_columns_serialized(new_attributes)
end
```

Closes #22438

See merge request !6470
2016-09-22 10:37:55 +00:00
..
assets Merge branch 'and-you-get-awards' into 'master' 2016-09-21 15:22:28 +00:00
controllers Merge branch 'and-you-get-awards' into 'master' 2016-09-21 15:22:28 +00:00
finders fix issues mr counter 2016-09-20 14:39:15 +01:00
helpers Hotfix the issuable counters when filtering by multiple labels 2016-09-22 11:21:57 +02:00
mailers Fix "Unsubscribe" link in notification emails that is triggered by anti-virus 2016-09-20 09:52:57 +02:00
models So that st_commits could never be nil 2016-09-22 17:28:36 +08:00
policies Cycle analytics should be accessible to all for public projects. 2016-09-20 16:22:19 +05:30
services Merge branch 'post-merge-improve-of-ci-permissions' into 'master' 2016-09-21 09:00:38 +00:00
uploaders
validators
views Stop disabling jump_to_next buttons, when not on latest MR diff. 2016-09-22 11:07:39 +02:00
workers