Actually, I check the size of a commit in the pre-commit hook. But all the files are commited before I can refuse the commit in pre-commit.
For example, if the size limit is 10 MB and the user sends 1 GB file, the 1 GB will be completely transfered to my server and then the pre-commit hook will refuse the transaction.
I want to refuse the transaction if the commit size is greater that the repository limit before all the files are transfered to the server.
How is this possible?