You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
642 B
23 lines
642 B
#!/bin/sh |
|
# |
|
# Check if copyright statements include the current year |
|
# http://damien.lespiau.name/blog/2013/01/13/a-git-pre-commit |
|
# |
|
files=`git diff --cached --name-only | grep '[.cpp|.h]$'` |
|
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
|
|
|