.git-hooks/pre-commit | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
New commits: commit 66fce1f61e7e088bd92e19ecb0dd94553de6f824 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri May 16 16:47:29 2014 +0200 git pre-commit hook: block large files Change-Id: Id27cfa805fc7cd0f4f6cc3d8bb770aa7abd536e1 diff --git a/.git-hooks/pre-commit b/.git-hooks/pre-commit index fdd07ad..6933198 100755 --- a/.git-hooks/pre-commit +++ b/.git-hooks/pre-commit @@ -131,6 +131,20 @@ EOM exit( 1 ); } +# Block large files. +open( FILES, "git diff --cached --name-only --diff-filter=A -z $against |" ) || die "Cannot run git diff-index."; +while (<FILES>) +{ + my $size = `git cat-file -s :$_`; + # For now let's say large is 500KB + my $limit = 500; + if ($size > $limit * 1024) + { + print "Error: Attempt to add a large file: $_, pleasy try to fit into $limit KB.\n"; + exit( 1 ); + } +} + # fix whitespace in code check_whitespaces( $against); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits