summaryrefslogtreecommitdiff
path: root/.git-hooks
diff options
context:
space:
mode:
Diffstat (limited to '.git-hooks')
-rwxr-xr-x.git-hooks/pre-commit14
1 files changed, 14 insertions, 0 deletions
diff --git a/.git-hooks/pre-commit b/.git-hooks/pre-commit
index fdd07ad94603..693319826b66 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);