summaryrefslogtreecommitdiff
path: root/.hooks/pre-commit.d/check_created_by
blob: 6e4d8d8bc3cc5ed560d906339951d3d369ac9367 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh
#
# Check that ports do not contain a 'Created by' tag
#

makefiles=$(git diff --name-only --cached --diff-filter=ACMR | grep -E '^[^/]+/[^/]+/Makefile$')
if [ $? -eq 0 ] ; then
	for makefile in ${makefiles} ; do
		created_by=$(head -n1 ${makefile} | awk -F : '/Created by/{print $NF}')
		if [ -n "${created_by}" ] ; then
			echo -e "[pre-commit] ERROR: ${makefile} contains obsolete 'Created by' line\n" \
			        "                    Please remove the the line, and append:\n\n" \
			        "                    - Removed 'Created by ${created_by}'.\n\n" \
			        "                    to your commit message."
			exit 1
		fi
	done
fi