When pull requests are updated, the system stores metadata that associates the commit and the pull request (see
BSERV-3574, released in Bitbucket Server/Data Center 5.11). When viewing that commit on the repository "Commits" tab, it will show the pull requests it's associated with, if any.
However, in certain scenarios, new commits associated with an existing pull request do not have that metadata link created. They still show up on the pull request's "Commits" tab, but when viewing the commit from the repository "Commits" tab (left sidebar) or retrieving pull requests by commit via REST the pull request will not be included.
- Create a pull request between two branches
- Add a new commit introducing a merge conflict with the target branch
- This step may not be necessary
- Add a new merge commit resolving the conflict
Viewing the merge commit on the repository's "Commits" tab or looking up pull requests associated the merge commit's hash via REST should show the pull request.
The pull request is not shown.
There is no workaround for this behavior. It requires a software update to fix, and the fix will not be applied retroactively to existing pull requests.