diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2017-12-22 18:58:05 +0300 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2018-01-03 14:02:37 +0300 |
commit | 8cf0ea4469290815daa1d64c4f3e16cbba8c00c1 (patch) | |
tree | a82a85ea9dbe7bba6efa9f196f85c238eb3dd14d /spec | |
parent | 48dacd5e74d17db6c058ea79301d237330980b0e (diff) |
Handle Gitaly aborted merge due to branch update
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/git/repository_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index 0e4292026df..c8ed0494f68 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -1719,6 +1719,20 @@ describe Gitlab::Git::Repository, seed_helper: true do expect(result.repo_created).to eq(false) expect(result.branch_created).to eq(false) end + + it 'returns nil if there was a concurrent branch update' do + concurrent_update_id = '33f3729a45c02fc67d00adb1b8bca394b0e761d9' + result = repository.merge(user, source_sha, target_branch, 'Test merge') do + # This ref update should make the merge fail + repository.write_ref(Gitlab::Git::BRANCH_REF_PREFIX + target_branch, concurrent_update_id) + end + + # This 'nil' signals that the merge was not applied + expect(result).to be_nil + + # Our concurrent ref update should not have been reversed + expect(repository.find_branch(target_branch).target).to eq(concurrent_update_id) + end end context 'with gitaly' do |