Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
d5e42f23
Commit
d5e42f23
authored
Feb 04, 2020
by
Gary Holtz
Committed by
Shinya Maeda
Feb 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Remove two_step_rebase feature flag"
parent
3f6a0167
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
85 deletions
+43
-85
app/models/repository.rb
app/models/repository.rb
+0
-4
changelogs/unreleased/29077-remove-two_step_rebase-feature-flag.yml
.../unreleased/29077-remove-two_step_rebase-feature-flag.yml
+5
-0
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+37
-58
spec/services/merge_requests/rebase_service_spec.rb
spec/services/merge_requests/rebase_service_spec.rb
+1
-23
No files found.
app/models/repository.rb
View file @
d5e42f23
...
...
@@ -1091,10 +1091,6 @@ class Repository
end
def
rebase
(
user
,
merge_request
,
skip_ci:
false
)
if
Feature
.
disabled?
(
:two_step_rebase
,
default_enabled:
true
)
return
rebase_deprecated
(
user
,
merge_request
)
end
push_options
=
[]
push_options
<<
Gitlab
::
PushOptions
::
CI_SKIP
if
skip_ci
...
...
changelogs/unreleased/29077-remove-two_step_rebase-feature-flag.yml
0 → 100644
View file @
d5e42f23
---
title
:
Update rebasing to use the new two-phase Gitaly Rebase RPC
merge_request
:
23546
author
:
type
:
changed
spec/models/repository_spec.rb
View file @
d5e42f23
...
...
@@ -1618,79 +1618,58 @@ describe Repository do
end
end
context
'when two_step_rebase feature is enabled'
do
before
do
stub_feature_flags
(
two_step_rebase:
true
)
end
it_behaves_like
'a method that can rebase successfully'
it
'executes the new Gitaly RPC'
do
expect_any_instance_of
(
Gitlab
::
GitalyClient
::
OperationService
).
to
receive
(
:rebase
)
expect_any_instance_of
(
Gitlab
::
GitalyClient
::
OperationService
).
not_to
receive
(
:user_rebase
)
repository
.
rebase
(
user
,
merge_request
)
end
describe
'rolling back the `rebase_commit_sha`'
do
let
(
:new_sha
)
{
Digest
::
SHA1
.
hexdigest
(
'foo'
)
}
it_behaves_like
'a method that can rebase successfully'
it
'does not rollback when there are no errors
'
do
second_response
=
double
(
pre_receive_error:
nil
,
git_error:
nil
)
mock_gitaly
(
second_respon
se
)
it
'executes the new Gitaly RPC
'
do
expect_any_instance_of
(
Gitlab
::
GitalyClient
::
OperationService
).
to
receive
(
:rebase
)
expect_any_instance_of
(
Gitlab
::
GitalyClient
::
OperationService
).
not_to
receive
(
:user_reba
se
)
repository
.
rebase
(
user
,
merge_request
)
repository
.
rebase
(
user
,
merge_request
)
end
expect
(
merge_request
.
reload
.
rebase_commit_sha
).
to
eq
(
new_sha
)
end
describe
'rolling back the `rebase_commit_sha`'
do
let
(
:new_sha
)
{
Digest
::
SHA1
.
hexdigest
(
'foo'
)
}
it
'does rollback when a PreReceiveError is encountered in the second step
'
do
second_response
=
double
(
pre_receive_error:
'my_error'
,
git_error:
nil
)
mock_gitaly
(
second_response
)
it
'does not rollback when there are no errors
'
do
second_response
=
double
(
pre_receive_error:
nil
,
git_error:
nil
)
mock_gitaly
(
second_response
)
expect
do
repository
.
rebase
(
user
,
merge_request
)
end
.
to
raise_error
(
Gitlab
::
Git
::
PreReceiveError
)
repository
.
rebase
(
user
,
merge_request
)
expect
(
merge_request
.
reload
.
rebase_commit_sha
).
to
be_nil
end
expect
(
merge_request
.
reload
.
rebase_commit_sha
).
to
eq
(
new_sha
)
end
it
'does rollback when a Git
Error is encountered in the second step'
do
second_response
=
double
(
pre_receive_error:
nil
,
git_error:
'git error'
)
mock_gitaly
(
second_response
)
it
'does rollback when a PreReceive
Error is encountered in the second step'
do
second_response
=
double
(
pre_receive_error:
'my_error'
,
git_error:
nil
)
mock_gitaly
(
second_response
)
expect
do
repository
.
rebase
(
user
,
merge_request
)
end
.
to
raise_error
(
Gitlab
::
Git
::
Repository
::
Git
Error
)
expect
do
repository
.
rebase
(
user
,
merge_request
)
end
.
to
raise_error
(
Gitlab
::
Git
::
PreReceive
Error
)
expect
(
merge_request
.
reload
.
rebase_commit_sha
).
to
be_nil
end
expect
(
merge_request
.
reload
.
rebase_commit_sha
).
to
be_nil
end
def
mock_gitaly
(
second_response
)
responses
=
[
double
(
rebase_sha:
new_sha
).
as_null_object
,
second_response
]
it
'does rollback when a GitError is encountered in the second step'
do
second_response
=
double
(
pre_receive_error:
nil
,
git_error:
'git error'
)
mock_gitaly
(
second_response
)
expect_any_instance_of
(
Gitaly
::
OperationService
::
Stub
).
to
receive
(
:user_rebase_confirmable
).
and_return
(
responses
.
each
)
end
end
end
expect
do
repository
.
rebase
(
user
,
merge_request
)
end
.
to
raise_error
(
Gitlab
::
Git
::
Repository
::
GitError
)
context
'when two_step_rebase feature is disabled'
do
before
do
stub_feature_flags
(
two_step_rebase:
false
)
expect
(
merge_request
.
reload
.
rebase_commit_sha
).
to
be_nil
end
it_behaves_like
'a method that can rebase successfully'
it
'executes the deprecated Gitaly RPC'
do
expect_any_instance_of
(
Gitlab
::
GitalyClient
::
OperationService
).
to
receive
(
:user_rebase
)
expect_any_instance_of
(
Gitlab
::
GitalyClient
::
OperationService
).
not_to
receive
(
:rebase
)
def
mock_gitaly
(
second_response
)
responses
=
[
double
(
rebase_sha:
new_sha
).
as_null_object
,
second_response
]
repository
.
rebase
(
user
,
merge_request
)
expect_any_instance_of
(
Gitaly
::
OperationService
::
Stub
).
to
receive
(
:user_rebase_confirmable
).
and_return
(
responses
.
each
)
end
end
end
...
...
spec/services/merge_requests/rebase_service_spec.rb
View file @
d5e42f23
...
...
@@ -71,14 +71,6 @@ describe MergeRequests::RebaseService do
it_behaves_like
'sequence of failure and success'
context
'with deprecated step rebase feature'
do
before
do
stub_feature_flags
(
two_step_rebase:
false
)
end
it_behaves_like
'sequence of failure and success'
end
context
'when unexpected error occurs'
do
before
do
allow
(
repository
).
to
receive
(
:gitaly_operation_client
).
and_raise
(
'Something went wrong'
)
...
...
@@ -140,21 +132,7 @@ describe MergeRequests::RebaseService do
end
end
context
'when the two_step_rebase feature is enabled'
do
before
do
stub_feature_flags
(
two_step_rebase:
true
)
end
it_behaves_like
'a service that can execute a successful rebase'
end
context
'when the two_step_rebase feature is disabled'
do
before
do
stub_feature_flags
(
two_step_rebase:
false
)
end
it_behaves_like
'a service that can execute a successful rebase'
end
it_behaves_like
'a service that can execute a successful rebase'
context
'when skip_ci flag is set'
do
let
(
:skip_ci
)
{
true
}
...
...
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