ContainerImage.Pinniped/hack/check-copyright-year.sh
Andrew Keesler 53a185083c Hopefully triggering the precommit hook
Signed-off-by: Margo Crawford <margaretc@vmware.com>
2021-01-05 14:15:46 -08:00

22 lines
553 B
Bash
Executable File

#
# Check if copyright statements include the current year
#
files=$(git diff --cached --name-only)
year=$(date +"%Y")
for f in $files; do
head -10 $f | grep -i copyright 2>&1 1>/dev/null || continue
if ! grep -i -e "copyright.*$year" $f 2>&1 1>/dev/null; then
missing_copyright_files="$missing_copyright_files $f"
fi
done
if [ -n "$missing_copyright_files" ]; then
echo "$year is missing in the copyright notice of the following files:"
for f in $missing_copyright_files; do
echo " $f"
done
exit 1
fi