| Server IP : 82.208.35.60 / Your IP : 216.73.216.238 Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31 System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64 User : studiokobylisy_cz ( 1008) PHP Version : 7.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/ports/.hooks/pre-commit.d/ |
Upload File : |
#!/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