Repository Graph loads slowly with refs that point to large blobs

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

When a repo has a ref that points directly to a large blob, the Repository Graph loads slowly.

Steps to reproduce

Add two refs, a tag that points to a blob 1GiB of zeros, and refs/blobs/big2 that points to 1GiB of random data.

dd if=/dev/zero bs=1M count=1024 of=/tmp/thing
sha=`git hash-object -w /tmp/thing`
git tag big1 "$sha"
dd if=/dev/urandom bs=1M count=1024 of=/tmp/thing
sha=`git hash-object -w /tmp/thing`
git tag big2 "$sha"
mkdir .git/refs/blobs
mv .git/refs/tags/big2 .git/refs/blobs/
git push --tags
git push 'refs/blobs/*:refs/blobs/*'

Then go to gitlab and try to look at the repository graph. It takes much longer than before adding these objects.

Example Project

https://gitlab.com/rigel314/test-large-blob

What is the current bug behavior?

Repository graph loads slowly.

What is the expected correct behavior?

Repository graph ignores refs that aren't commits and loads quickly.

Relevant logs and/or screenshots

I expect it is trying to place all refs on the graph view. But it should only do that for refs that point to commits.

$ git cat-file -t refs/tags/big1
blob
$ git cat-file -t refs/heads/master
commit

Output of checks

This bug happens on GitLab.com This bug also happens with GitLab Community Edition (10.1.0)

Edited by 🤖 GitLab Bot 🤖