mirror of
https://git.freebsd.org/ports.git
synced 2025-04-28 09:36:41 -04:00
Add common error function in hooks Error messages are printed in stderr Reviewed By: tcberner, #portmgr Differential Revision: https://reviews.freebsd.org/D38026
23 lines
766 B
Bash
Executable file
23 lines
766 B
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# Check that ports do not contain a 'Created by' tag
|
|
#
|
|
|
|
common_functions="$(realpath "$(dirname "$0")")/common.sh"
|
|
if [ -r "${common_functions}" ]; then
|
|
. "${common_functions}"
|
|
fi
|
|
|
|
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
|
|
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
|