BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
8cf0ea44
Commit
8cf0ea44
authored
Dec 22, 2017
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle Gitaly aborted merge due to branch update
parent
48dacd5e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
operation_service.rb
lib/gitlab/gitaly_client/operation_service.rb
+1
-0
repository_spec.rb
spec/lib/gitlab/git/repository_spec.rb
+14
-0
No files found.
lib/gitlab/gitaly_client/operation_service.rb
View file @
8cf0ea44
...
@@ -101,6 +101,7 @@ module Gitlab
...
@@ -101,6 +101,7 @@ module Gitlab
request_enum
.
push
(
Gitaly
::
UserMergeBranchRequest
.
new
(
apply:
true
))
request_enum
.
push
(
Gitaly
::
UserMergeBranchRequest
.
new
(
apply:
true
))
branch_update
=
response_enum
.
next
.
branch_update
branch_update
=
response_enum
.
next
.
branch_update
return
if
branch_update
.
nil?
raise
Gitlab
::
Git
::
CommitError
.
new
(
'failed to apply merge to branch'
)
unless
branch_update
.
commit_id
.
present?
raise
Gitlab
::
Git
::
CommitError
.
new
(
'failed to apply merge to branch'
)
unless
branch_update
.
commit_id
.
present?
Gitlab
::
Git
::
OperationService
::
BranchUpdate
.
from_gitaly
(
branch_update
)
Gitlab
::
Git
::
OperationService
::
BranchUpdate
.
from_gitaly
(
branch_update
)
...
...
spec/lib/gitlab/git/repository_spec.rb
View file @
8cf0ea44
...
@@ -1719,6 +1719,20 @@ describe Gitlab::Git::Repository, seed_helper: true do
...
@@ -1719,6 +1719,20 @@ describe Gitlab::Git::Repository, seed_helper: true do
expect
(
result
.
repo_created
).
to
eq
(
false
)
expect
(
result
.
repo_created
).
to
eq
(
false
)
expect
(
result
.
branch_created
).
to
eq
(
false
)
expect
(
result
.
branch_created
).
to
eq
(
false
)
end
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
end
context
'with gitaly'
do
context
'with gitaly'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment