Skip to content

Fix attr reader to force the intended values for source and target shas

Douglas Barbosa Alexandre requested to merge fix-gh-pull-requests into master

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 introduced this bug in the importer.

What are the relevant issue numbers?

gitlab-org/gitlab-ce#20385

Does this MR meet the acceptance criteria?

/cc @akitaonrails @DouweM

Merge request reports