We have seen this really odd behavior that I cannot explain.
When looking at a pull request via the web interface, its “mergeability” is calculated by calling the merge check(s) activated in the target repository. That’s fine.
But, in some situations, also the hook(s) in the target repository are called?!
This can be reproduced with Bitbucket 5.2, using built-in hooks and merge checks. (I can share a test case if necessary.)
I couldn’t decide if this is a bug or a feature.
We thought it may be a feature and the idea is that the pre-receive hook wants to verify if the commits in the pull request are allowed to be added to the target repo and branch.
But there are two symptoms that contradict this:
- Seemingly, the hook is called before the merge check (so timing is counter-intuitive)
- The hook receives a empty collection of ref changes (so the hook cannot really do anything meaningful)
So, how is this supposed to work? Is this a bug or a feature?