-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Low
-
None
-
Affects Version/s: 7.21.10, 8.8.2
-
Component/s: Pull Request - Merge
-
3
-
Severity 3 - Minor
-
1
Issue Summary
When a Bitbucket repository is imported from a pre-Bitbucket 7.x instance to a different instance, the refs/pull-requests/* are transferred to the target instance from the source instance. The refs are packed after the Git import and end up in the $BITBUCKET_SHARED/data/repositories/<repo_id>/packed-refs. Therefore, if the source instance has open pull requests with active merge refs(refs/pull-requests/*/merge), they are transferred to the target instance and remain in the packed-refs forever, which causes them to be advertised when using the git ls-remote command.
This is reproducible on Data Center: (yes)
Steps to Reproduce
- Create a repository on Bitbucket 6.x and make changes.
- Create a pull request to merge the changes to another branch. This should create a merge ref under refs/pull-requests/<PR_ID>/.
- Import the repository into a Bitbucket 7.x instance.
- After a few minutes, a pack operation will be performed to pack all the loose refs.
- The refs/pull-requests/* will be moved to $BITBUCKET_SHARED/data/repositories/<repo_id>/packed-refs
- The merge refs are now packed and will never be cleaned up when a new pull request is opened on the Bitbucket 7.x instance.
- The new pull request created on the target instance will still have an old merge ref(refs/pull-requests/*/merge attached to it that came from the source instance. However, the merge ref will be pointing to an incorrect commit ID from the source Bitbucket Instance.
Expected Results
- The refs/pull-requests/<PR_ID>/merge should be cleaned up on Bitbucket 7.x,8.x for the repository, even if it is packed and under the
$BITBUCKET_SHARED/data/repositories/<repo_id>/packed-refs file.
Actual Results
- The merge refs are cleaned up only when a new Pull Request (on Target instance) matching the same pull request ID imported from the source instance is created, meaning when these refs are under the directory $BITBUCKET_SHARED/data/repositories/<repo_id>/refs/pull-requests/<PR_ID>/merge.
- However, if these refs are packed and moved to $BITBUCKET_SHARED/data/repositories/<repo_id>/packed-refs, they are left untouched and will be advertised forever.
Workaround
- Remove the problematic merge ref from $BITBUCKET_SHARED/data/repositories/<repo_id>/packed-refs, you need to manually delete the entry.
- Alternatively, you can remove it by running "git update-ref -d refs/pull-requests/<PR_ID>/merge" from the $BITBUCKET_SHARED/data/repositories/<repo_id> directory.
- mentioned in
-
Page Loading...