"should_remove_source_branch" is being ignored when accepting MR from API.
Summary
When accepting a merge request from the API, the should_remove_source_branch
property in the posted JSON message isn't used.
Steps to reproduce
I am using GitLab Enterprise v11.0.2.
Url
PUT https://domain.com/api/v4/projects/13/merge_requests/17/merge
Request body
{
"id": 13,
"merge_commit_message": "test message",
"should_remove_source_branch": true
}
Response body
What is the current bug behavior?
The merge request is accepted, but the should_remove_source_branch
property is ignored, and whatever value was used when creating the merge request is used.
What is the expected correct behavior?
I expected the request to use the should_remove_source_branch
property that was present in the posted json content. Note, it did successfully use the merge_commit_message
message.
Relevant logs and/or screenshots
Here is the response of the above example request.
{
"id": 21,
"iid": 17,
"project_id": 13,
"title": "Update test-section.md",
"description": "",
"state": "merged",
"created_at": "2018-06-30T19:01:47.171Z",
"updated_at": "2018-06-30T21:55:12.402Z",
"target_branch": "master",
"source_branch": "patch-1",
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 1,
"name": "Test User",
"username": "user1",
"state": "active",
"avatar_url": "https://secure.gravatar.com/avatar/url",
"web_url": "https://domain.com/user1"
},
"assignee": null,
"source_project_id": 13,
"target_project_id": 13,
"labels": [],
"work_in_progress": false,
"milestone": null,
"merge_when_pipeline_succeeds": false,
"merge_status": "can_be_merged",
"sha": "7f3b11bc8b7ef0bc0bf5cfa3e3822108465d94b5",
"merge_commit_sha": "df6dada520f91713cfd182259345fef9cfb870ee",
"user_notes_count": 0,
"discussion_locked": null,
"should_remove_source_branch": null,
"force_remove_source_branch": false,
"web_url": "https://domain.com/group/project/merge_requests/17",
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"squash": false,
"subscribed": true,
"changes_count": "1",
"merged_by": {
"id": 4,
"name": "Test User2",
"username": "user2",
"state": "active",
"avatar_url": "https://secure.gravatar.com/avatar/url",
"web_url": "https://domain.com/user2"
},
"merged_at": "2018-06-30T21:55:12.410Z",
"closed_by": null,
"closed_at": null,
"latest_build_started_at": "2018-06-30T19:01:31.970Z",
"latest_build_finished_at": "2018-06-30T19:02:04.777Z",
"first_deployed_to_production_at": null,
"pipeline": {
"id": 482,
"sha": "7f3b11bc8b7ef0bc0bf5cfa3e3822108465d94b5",
"ref": "patch-1",
"status": "success"
},
"diff_refs": {
"base_sha": "8cb7609f987a3fccedc1e11c121ddcff2121b8b8",
"head_sha": "7f3b11bc8b7ef0bc0bf5cfa3e3822108465d94b5",
"start_sha": "8cb7609f987a3fccedc1e11c121ddcff2121b8b8"
},
"approvals_before_merge": 1
}
Results of GitLab environment info
System information
System:
Proxy: no
Current User: git
Using RVM: no
Ruby Version: 2.4.4p296
Gem Version: 2.7.6
Bundler Version:1.16.2
Rake Version: 12.3.1
Redis Version: 3.2.11
Git Version: 2.17.1
Sidekiq Version:5.1.3
Go Version: unknown
GitLab information
Version: 11.0.2-ee
Revision: 74d8455
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
DB Version: 9.6.8
URL: https://domain.com
HTTP Clone URL: https://domain.com/some-group/some-project.git
SSH Clone URL: git@domain.com:some-group/some-project.git
Elasticsearch: no
Geo: no
Using LDAP: no
Using Omniauth: no
GitLab Shell
Version: 7.1.4
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks
Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Checking GitLab Shell ...
GitLab Shell version >= 7.1.4 ? ... OK (7.1.4)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:root, or git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ...
3/1 ... ok
3/2 ... ok
1/4 ... ok
5/5 ... ok
1/6 ... ok
3/7 ... ok
8/8 ... ok
9/9 ... ok
1/10 ... ok
9/11 ... repository is empty
3/12 ... repository is empty
9/13 ... ok
11/14 ... ok
12/15 ... ok
12/16 ... repository is empty
13/17 ... repository is empty
9/18 ... ok
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Redis available via internal API: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Reply by email is disabled in config/gitlab.yml
Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Git configured correctly? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config up to date? ... yes
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory exists? ... yes
Uploads directory has correct permissions? ... yes
Uploads directory tmp has correct permissions? ... yes
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
Projects have namespace: ...
3/1 ... yes
3/2 ... yes
1/4 ... yes
5/5 ... yes
1/6 ... yes
3/7 ... yes
8/8 ... yes
9/9 ... yes
1/10 ... yes
9/11 ... yes
3/12 ... yes
9/13 ... yes
11/14 ... yes
12/15 ... yes
12/16 ... yes
13/17 ... yes
9/18 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.3.5 ? ... yes (2.4.4)
Git version >= 2.9.5 ? ... yes (2.17.1)
Git user has default SSH configuration? ... yes
Active users: ... 6
Elasticsearch version 5.1 - 5.5? ... skipped (elasticsearch is disabled)
Checking GitLab ... Finished
Edited by 🤖 GitLab Bot 🤖