Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108447310
D35041.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
D35041.diff
View Options
diff --git a/.hooks/pre-commit.d/check_mk_indentations b/.hooks/pre-commit.d/check_mk_indentations
new file mode 100755
--- /dev/null
+++ b/.hooks/pre-commit.d/check_mk_indentations
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# Check that Mk/ files are properly indented
+#
+
+check_indentation() {
+ local mkfile="$1"
+ local name=$(echo "${mkfile}" | awk -F / '{print $NF}')
+ local tempdir=$(mktemp -d -t check_indentations-${name})
+ if [ $? -ne 0 ] ; then
+ echo "[pre-commit] failed to create tempdir"
+ exit 2
+ fi
+ cp ${mkfile} ${tempdir} && Tools/scripts/indent_make_if.pl ${tempdir}/${name}
+ if [ $? -ne 0 ] ; then
+ echo "[pre-commit] failed to run Tools/scripts/indent_make_if.pl"
+ exit 2
+ fi
+ cmp -s ${tempdir}/*
+ if [ $? -ne 0 ] ; then
+ echo "[pre-commit] ${name} is not properly indented -- please use ${tempdir}/${name} which was created using Tools/scripts/indent_make_if.pl"
+ exit 1
+ fi
+}
+
+modified_mks=$(git diff --name-only --cached --diff-filter=ACRM | grep -E '^Mk/.*\.mk$')
+if [ $? -eq 0 ] ; then
+ for modified_mk in ${modified_mks} ; do
+ check_indentation "${modified_mk}"
+ done
+fi
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 25, 9:05 PM (16 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16162671
Default Alt Text
D35041.diff (1 KB)
Attached To
Mode
D35041: .hooks: add hook to check indentation of conditionals of Mk/ files
Attached
Detach File
Event Timeline
Log In to Comment