Details
-
Bug
-
Resolution: Fixed
-
Low
-
153
-
2
-
Description
When merging a pull-request, via the Bitbucket REST API, if no body is provided then the original close_source_branch value (on the PR) is both ignored, and overwritten.
According to the API documentation:
close_source_branch boolean
Whether the source branch should be deleted. If this is not provided, we fallback to the value used when the pull request was created, which defaults to False*
Steps to replicate
- Create a pull-request, and specify close_source_branch
POST https://api.bitbucket.org/2.0/repositories/<owner>/<slug>/pullrequests { ... "close_source_branch": true }
- Retrieve the pull request - confirm that close_source_branch is still true
GET https://api.bitbucket.org/2.0/repositories/<owner>/<slug>/pullrequests/<id>
- Merge the PR, without a request body
POST https://api.bitbucket.org/2.0/repositories/<owner>/<slug>/pullrequests/<id>/merge
- Retrieve the pull request
GET https://api.bitbucket.org/2.0/repositories/<owner>/<slug>/pullrequests/<id>
Expected: close_source_branch is still true, and the source branch was closed after the merge was completed
Actual: close_source_branch is overwritten to be false, and the source branch remains open after the merge was completed