2021-01-05 23:53:14 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Copyright 2021 the Pinniped contributors. All Rights Reserved.
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
2021-01-05 22:02:28 +00:00
|
|
|
#
|
|
|
|
# Check if copyright statements include the current year
|
|
|
|
#
|
2021-01-05 22:15:46 +00:00
|
|
|
files=$(git diff --cached --name-only)
|
|
|
|
year=$(date +"%Y")
|
2021-01-05 22:02:28 +00:00
|
|
|
|
|
|
|
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"
|
2021-01-05 23:53:14 +00:00
|
|
|
done
|
2021-01-05 22:02:28 +00:00
|
|
|
exit 1
|
|
|
|
fi
|