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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
c85a768c
Commit
c85a768c
authored
Feb 25, 2019
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Respect the should_remove_source_branch parameter to the merge API
parent
d93d799b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
2 deletions
+22
-2
changelogs/unreleased/58020-fix-merge-api-endpoint-param.yml
changelogs/unreleased/58020-fix-merge-api-endpoint-param.yml
+5
-0
lib/api/merge_requests.rb
lib/api/merge_requests.rb
+2
-2
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+15
-0
No files found.
changelogs/unreleased/58020-fix-merge-api-endpoint-param.yml
0 → 100644
View file @
c85a768c
---
title
:
Respect the should_remove_source_branch parameter to the merge API
merge_request
:
25525
author
:
type
:
fixed
lib/api/merge_requests.rb
View file @
c85a768c
...
@@ -369,11 +369,11 @@ module API
...
@@ -369,11 +369,11 @@ module API
merge_request
.
update
(
squash:
params
[
:squash
])
if
params
[
:squash
]
merge_request
.
update
(
squash:
params
[
:squash
])
if
params
[
:squash
]
merge_params
=
{
merge_params
=
HashWithIndifferentAccess
.
new
(
commit_message:
params
[
:merge_commit_message
],
commit_message:
params
[
:merge_commit_message
],
squash_commit_message:
params
[
:squash_commit_message
],
squash_commit_message:
params
[
:squash_commit_message
],
should_remove_source_branch:
params
[
:should_remove_source_branch
]
should_remove_source_branch:
params
[
:should_remove_source_branch
]
}
)
if
merge_when_pipeline_succeeds
&&
merge_request
.
head_pipeline
&&
merge_request
.
head_pipeline
.
active?
if
merge_when_pipeline_succeeds
&&
merge_request
.
head_pipeline
&&
merge_request
.
head_pipeline
.
active?
::
MergeRequests
::
MergeWhenPipelineSucceedsService
::
MergeRequests
::
MergeWhenPipelineSucceedsService
...
...
spec/requests/api/merge_requests_spec.rb
View file @
c85a768c
...
@@ -984,6 +984,21 @@ describe API::MergeRequests do
...
@@ -984,6 +984,21 @@ describe API::MergeRequests do
expect
(
squash_commit
.
message
).
to
eq
(
merge_request
.
default_squash_commit_message
)
expect
(
squash_commit
.
message
).
to
eq
(
merge_request
.
default_squash_commit_message
)
end
end
end
end
describe
"the should_remove_source_branch param"
do
let
(
:source_repository
)
{
merge_request
.
source_project
.
repository
}
let
(
:source_branch
)
{
merge_request
.
source_branch
}
it
'removes the source branch when set'
do
put
(
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/merge"
,
user
),
params:
{
should_remove_source_branch:
true
}
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
source_repository
.
branch_exists?
(
source_branch
)).
to
be_falsy
end
end
end
end
describe
"PUT /projects/:id/merge_requests/:merge_request_iid"
do
describe
"PUT /projects/:id/merge_requests/:merge_request_iid"
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