Find a branch given a commit id

In a Bitbucket Server plugin I need to find the branches which contain a commit.

ie: git branch --contains hash

From exploring the code I found: com.atlassian.bitbucket.internal.branch.BranchService#findByCommit
which appears to do exactly what I need, but is not exposed to plugins via an OSGi service, and even more annoyingly it also has the comment:

//TODO Expose this via the RefService for 4.0

Unfortunately it seems no-one did this TODO, and RefService doesn’t contain this functionality (in Bitbucket 4.14.4 at time of writing)

Does anyone know a work-around? (hitting the REST API instead is not a viable work-around)
or does Atlassian plan to do the TODO at some point?

com.atlassian.bitbucket.internal.branch.BranchService#findByCommit which appears to do exactly what I need, but is not exposed to plugins via an OSGi service

We were still stuck with the same problem even on Bitbucket 7.21…!

hitting the REST API instead is not a viable work-around

Thanks for the hint, we will try to use com.atlassian.bitbucket.internal.branch.rest.BranchUtilsResource#findByCommit.

Cheers.