I’m currently thinking of changing my VCS (from subversion) to git. Is it possible to limit the file size within a commit in a git repository? For e. g. subversion there is a hook: http://www.davidgrant.ca/limit_size_of_subversion_commits_with_this_hook
From my experience people, especially those who are inexperienced, sometimes tend to commit files which should not go into a VCS (e. g. big file system images).
As I was struggling with it for a while, even with the description, and I think this is relevant for others too, I thought I’d post an implementation of how what J16 SDiZ described could be implemented.
So, my take on the server-side
updatehook preventing too big files to be pushed:Note that it’s been commented that this code only checks the latest commit, so this code would need to be tweaked to iterate commits between $2 and $3 and do the check to all of them.