Best approach for commit ahead/behind graph implementation

I am currently working on this feature to display graphs of the number of commits a branch is ahead and behind of the default branch.

I have a current semi-working implementation that creates a hash as needed of how many commits ahead/behind a branch is compared to repository.root_ref. This hash is cached like many other high-computation items but for larger repositories, it can still break for repos with many branches (e.g. it fails on GitLab CE as included in the development kit and will almost certainly break on a 392 branch repo I use where I work).

Only 10 branches are needed at a time (paginated branch page), but the cache item calculates everything at once. I am wondering if there is a better way that would stay with the general architecture of GitLab. I am considering something along the lines of creating a cached item for each branch and then only needing to update them for 10 per page. I could do even do an AJAX request to get them asynchronously from the rest of the page (such as the network page).

Any thoughts?
Thank you.

Did you ever get any ideas here? Did you complete it? Abandon it?


Yeah, it was added a few months ago. There is some slowness reported on very large repos (e.g. 1000s of branches) that I am working on after some other people did some quick performance improvements/workarounds, but the main implementation is in.

So if I want to try it and I clone gitlab repos and set up a bleeding-edge-canary vm, and follow the trunk I should see it?


It’s been released for several months now. Just look at the branches page if you have more than one branch.

For example,

Oh I see. It shows how far ahead/behind the branches in ONE repo are to another, whereas I’m wondering how to see how far ahead the different FORKS of one repo are to another repo upstream.

If I was on the client side I would be trying to do this with say, a local repo and say, 4 or 5 remotes. If I am on the gitlab server, there is a page showing forks, and that page doesn’t show similar commit-delta status to the way the branches does. shows me all branches of one project, and their relation to master. I want to see that for FORKS.


It is on my todo list to experiment with combining different forks on the network page already, so if you have any ideas with regards to this, I’d be interested.

What exactly would you be interested in comparing? The graphs that I added compare each non-default ref to the default ref (usually compares every branch to master). What would be compared between forks? Usually, esp with GitLab flow, a user makes a fork of a project and makes a feature branch, so I’d need to also have graphs showing each branches relation to master of the project the fork is from. Perhaps a switch to toggle between that repo and the one it is forked from?