I'm writing a pre-receive hook for GitLab, based on this question ( https://stackoverflow.com/questions/47791509/how-to-prevent-a-git-repository-growing-above-a-maximum-size?noredirect =1&lq=1 ), which blocks repository updates if they exceed a size limit.
The problem is that the command they use there to know the size of the repository ( git count-objects -v
), does not return the actual size of the repository.
When comparing the size returned by that command, with the one shown by the GitLab API, I see that the GitLab API shows a different value (usually higher) than the one shown by this command.
The size shown by git-count
in the pre-receive is this (see error line)
While GitLab shows this other size
One way to get it would be by calling the API itself. But, for that, I would need to know the name and owner of the project I am in. And it doesn't seem trivial
how could i get the actual size of the project?