aboutsummaryrefslogtreecommitdiffstats
path: root/modules/subversion
diff options
context:
space:
mode:
Diffstat (limited to 'modules/subversion')
-rw-r--r--modules/subversion/manifests/init.pp8
-rw-r--r--modules/subversion/templates/no_binary14
2 files changed, 22 insertions, 0 deletions
diff --git a/modules/subversion/manifests/init.pp b/modules/subversion/manifests/init.pp
index 7b9da2d0..6036291c 100644
--- a/modules/subversion/manifests/init.pp
+++ b/modules/subversion/manifests/init.pp
@@ -31,6 +31,14 @@ class subversion {
content => template('subversion/create_svn_repo.sh')
}
+ file { "$local_dir/pre-commit.d/no_binary":
+ ensure => present,
+ owner => root,
+ group => root,
+ mode => 755,
+ content => template('subversion/no_binary')
+ }
+
file { "$local_dir/pre-commit.d/no_root_commit":
ensure => present,
owner => root,
diff --git a/modules/subversion/templates/no_binary b/modules/subversion/templates/no_binary
new file mode 100644
index 00000000..5787eae7
--- /dev/null
+++ b/modules/subversion/templates/no_binary
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+REP="$1"
+TXN="$2"
+
+# Filter some binary files based on common filename extentions.
+# It does not fully prevent commit of binary files, this script is only
+# here to avoid simple mistakes
+if svnlook changed -t "$TXN" "$REP" | grep -qi '\.\(gz\|bz2\|xz\|lzma\|Z\|7z\|tar\|tgz\|zip\|jpg\|gif\|png\|ogg\|mp3\|wav\|rar\|pdf\)$'
+then
+ echo 'no binary files allowed on this repository'
+ exit 1
+fi
+