Simplify tests of RepositorySize and GetObjectDirectorySize
This simplifies the tests for the repo size RPC's, and also strengthens them to make stronger claims.
Our test suite is already built on a known test repository https://gitlab.com/gitlab-org/gitlab-test.git. This repository is only like to grow, not shrink over time. So we can safely say its size is at least X bytes. I rounded down the size of the single packfile defining the repo after a git gc
as that X.
The test code this is replacing had comments about special behavior of du
. It is true that du foo.git/objects
is not the same as summing the sizes of all the files in foo.git/objects
. If there are hard links then du
avoids double counting. If files have holes then du
does not count the holes. However, neither of these applies to a Git object directory. Loose object files have different contents by definition (they have different SHA1 hashes!) so they cannot share disk blocks. Also, object files are compressed and should never have holes in them.