Squash merge using API doesn't have proper merge commit message

XMLWordPrintable

    • 1
    • Severity 3 - Minor
    • 61

      Issue Summary

      Merge using API with Squash merge strategy doesn't have proper commit message. It doesn't prepare the commit message as it is prepared while doing the merge using Bitbucket UI. This cause the issue doing the merge using API for repositories having Require issue keys in commit messages feature on.

      Steps to Reproduce

      1. Enable Require issue keys in commit messages feature in repository.
      2. Configure Default Merge strategy as Squash in repository settings in Merge strategy section
      3. Create a Pull request
      4. Merge the Pull request using API as follows - 
        https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/merge 
        

      Expected Results

      The merge should happen successfully. The merge commit should be similar to what we have when do the merge using UI as follows - 

      Merged in <source branch name> (pull request #<Pull Request Number>)
      
      <Pull Request Title>
      
      <Consolidated list of commit messages of commits in the Pull Request>

      Actual Results

      The merge doesn't happen successfully and following error is returned

      RepoError: pre-receive hook exited with 1
      
      One of your commit messages is missing a valid issue key:
      

      Workaround

      Please use one of the following workaround until the issue is fixed permanently 

      • Use UI to perform merge
      • Disable Require issue keys in commit messages before the merge through API and enable it after the merge
      • Specify merge commit having Jira issue key in API call as follows -
        https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/merge  -H 'content-type: application/json' --data '{"message": "commit message with issue key"}'
        

            Assignee:
            Unassigned
            Reporter:
            Sandeep K
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: