Skip to content

Instantly share code, notes, and snippets.

@rullzer
Created October 10, 2016 11:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rullzer/c4218df83657638bf6b22efb203de459 to your computer and use it in GitHub Desktop.
Save rullzer/c4218df83657638bf6b22efb203de459 to your computer and use it in GitHub Desktop.
#
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment