diff options
author | Pierre de La Morinerie <kemenaran@gmail.com> | 2016-03-09 10:19:54 +0300 |
---|---|---|
committer | Pierre de La Morinerie <kemenaran@gmail.com> | 2016-03-16 16:02:04 +0300 |
commit | 18295585d9d2a7177f52fc451db7b0d542cc49b5 (patch) | |
tree | cd60e7b0b194c6f2c187bf30a1ff2db360427f22 /spec/factories | |
parent | 7cbf8fd0d089264f863dc01217514d7e2c40e056 (diff) |
Fix MergeRequest#source_sha when there is no diff
`MergeRequest#source_sha` is expected to return the sha of the source
branch last commit.
But when a open Merge Request has no diff (e.g. all commits have already
been merged to the target branch), `merge_request.source_sha`
incorrectly returns `nil`.
This was un-noticed before – but now that !2217 has been merged,
it makes `Gitlab::Git::Commit.between` raise an
"Unexpected nil argument" exception.
This fixes the crash, by making sure that `source_sha` returns a
correct result even when there is no diff available.
Diffstat (limited to 'spec/factories')
-rw-r--r-- | spec/factories/merge_requests.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/factories/merge_requests.rb b/spec/factories/merge_requests.rb index a9df5fa1d3a..e281e2f227b 100644 --- a/spec/factories/merge_requests.rb +++ b/spec/factories/merge_requests.rb @@ -51,6 +51,11 @@ FactoryGirl.define do trait :with_diffs do end + trait :without_diffs do + source_branch "improve/awesome" + target_branch "master" + end + trait :conflict do source_branch "feature_conflict" target_branch "feature" |