Skip requesting diverging commit counts if no branches are listed
When a branch list is displayed in the UI, the diverging commit counts
are usually displayed for a subset of branches available in the
repository to prevent excessive Gitaly calls using the names
parameter. However, when clicking on the different tabs in the branch
controller (e.g. Stale, Active), it's possible the list is empty. Since
the names parameter is empty, the backend thinks it should return
the counts for ALL branches.
We can save considerable I/O in this case by not making the request at all.
Part of https://gitlab.com/gitlab-org/gitlab-ce/issues/66200
Edited by Stan Hu