gitlab-org--gitlab-foss/spec
Rémy Coutable be7ab1f2bc Merge branch 'fix-gh-pull-requests' into 'master'
Fix attr reader to force the intended values for source and target shas

## What does this MR do?

When importing a pull request from GitHub, the old and new branches may no longer actually exist by those names, but we need to recreate the merge
request diff with the right source and target shas.  We use these `target_branch_sha` and `source_branch_sha` attributes to force  these to the intended values. But the reader methods were always looking up to the target/source branch head instead of check if these values was  previously set, this MR applies a memoization pattern to both of them.

## Are there points in the code the reviewer needs to double check?

This [commit](6ce25e7b4c) introduced this bug in the importer.

## What are the relevant issue numbers?

gitlab-org/gitlab-ce#20385

## Does this MR meet the acceptance criteria?

- [X] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [X] ~~[Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~
- [X] ~~API support added~~
- Tests
  - [X] Added for this feature/bug
  - [ ] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [ ] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

/cc @akitaonrails @DouweM 

See merge request !5573
2016-08-01 13:04:46 +00:00
..
config
controllers Incorporate feedback 2016-07-29 13:54:45 +02:00
factories Merge branch 'zj-env-external-url' into 'master' 2016-08-01 09:04:09 +00:00
features Merge branch '15064_issuable_default_sort_order' into 'master' 2016-08-01 12:02:47 +00:00
finders Fix specs 2016-08-01 13:24:06 +02:00
fixtures Merge remote-tracking branch 'upstream/master' into new-issue-by-email 2016-07-26 14:51:52 +08:00
helpers Improve diff performance by eliminating redundant checks for text blobs 2016-07-29 21:06:50 -07:00
initializers Ignore invalid IPs in X-Forwarded-For when trusted proxies are configured. 2016-07-31 15:36:11 -04:00
javascripts ES6ify all the things! 2016-07-24 23:45:11 +03:00
lib Fix specs 2016-08-01 13:24:06 +02:00
mailers Make Notify specs more robust by setting up assignee names 2016-07-22 13:54:12 +02:00
models Merge branch 'fix-gh-pull-requests' into 'master' 2016-08-01 13:04:46 +00:00
requests Minor fixes in the Env API endpoints 2016-08-01 08:42:09 +02:00
routing Clean up unused routes 2016-07-26 12:06:42 +02:00
services Properly abort a merge when merge conflicts occur 2016-07-29 11:21:21 -07:00
support Merge branch 'fix-extra-new-line-crlf' into 'master' 2016-08-01 12:30:13 +00:00
tasks/gitlab Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
uploaders Remove VideoJS and clean the integration 2016-07-20 11:36:42 +02:00
views Update to gitlab_git 10.4.1 and take advantage of preserved Ref objects 2016-07-28 12:24:47 -04:00
workers Merge remote-tracking branch 'upstream/master' into new-issue-by-email 2016-07-27 18:11:50 +08:00
factories_spec.rb
rails_helper.rb
simplecov_env.rb Introduce SimpleCovEnv singleton helper and use it 2016-07-21 12:46:49 +02:00
spec_helper.rb Introduce SimpleCovEnv singleton helper and use it 2016-07-21 12:46:49 +02:00
teaspoon_env.rb