Gitaly does not properly calculate push size
Summary
When users migrate from our SVN repos to Gitlab projects, they frequently have this error when pushing a migrated repo to GitLab:
remote: GitLab: Your push to this repository would cause it to exceed the size limit of 10 GB so it has been rejected. Please contact your GitLab administrator for more information
This is because gitlab does not seem to calculate push sizes correctly in 2 cases:
- pushed files are easily compressible and uncompressed_size > limit while compressed_size < limit
- many refs (branches/tags) are pushed at the same time: Gitlab seems to sum the size of the history of each ref, when probably most of the history is shared
Steps to reproduce
Reproduced on 11.6.9-ee using gitaly:
- Create a project, it will have a 10GB size limit by default
- Create a file that does not use the whole size limit (~6GB):
dd if=/dev/zero of=file.txt count=6291456 bs=1024
git add + git commit
- Create a new branch, edit the created file,
cat >> file.txt
to append something. git add + git commit
- Try to push everything, it fails with the mentioned error.
I could not reproduce it on gitlab.com, are you using gitaly?
What is the current bug behavior?
The push size is not correctly calculated
What is the expected correct behavior?
Push should work, as it does not use the whole size limit.
Possible fixes
Possible line of code: gitaly@726e6cd1
Feel free to move this issue to https://gitlab.com/gitlab-org/gitaly if needed.
Edited by Daniel Juarez