Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F133671697
D37387.id113095.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D37387.id113095.diff
View Options
Index: .hooks/pre-commit.d/check_files
===================================================================
--- /dev/null
+++ .hooks/pre-commit.d/check_files
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# Check that only standard files are added to a port
+#
+# .*\.mk
+# Makefile.*
+# dist-info.*
+# pkg-descr.*
+# pkg-message.*
+# pkg-plist.*
+# pkg-post.*
+#
+
+newish_files=$(git diff --name-only --cached --diff-filter=ACR | grep -E '^[^/]+/[^/]+/[^/]+$' | grep -v '/files/' | grep -v '^\.')
+status=0
+if [ $? -eq 0 ] ; then
+ for newish_file in ${newish_files} ; do
+ category=$(echo "${newish_file}" | awk -F '/' '{print $1}')
+ port=$(echo "${newish_file}" | awk -F '/' '{print $2}')
+ file=$(echo "${newish_file}" | awk -F '/' '{print $3}')
+ valid=$(echo "${file}" | grep -q '^((Makefile|distinfo|pkg-)(.*))|(.*\.mk)$')
+ if [ $? -ne 0 ] ; then
+ echo "[pre-commit] ERROR: invalid file '${file}' in '${category}/${port}'"
+ status=1
+ fi
+ done
+fi
+if [ ${status} -eq 1 ] ; then
+ echo " Consider moving non-standard files to files/ or force-ignore this hook."
+ exit 1
+fi
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Oct 28, 11:20 AM (14 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24353542
Default Alt Text
D37387.id113095.diff (1 KB)
Attached To
Mode
D37387: framework: new hook to only allow 'default' files in category/port
Attached
Detach File
Event Timeline
Log In to Comment