Kaydet (Commit) 66fce1f6 authored tarafından Miklos Vajna's avatar Miklos Vajna

git pre-commit hook: block large files

Change-Id: Id27cfa805fc7cd0f4f6cc3d8bb770aa7abd536e1
üst fcf5b5c0
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment