Scripts/git-pre-commit-hook : Restrict copyright year checks.

This commit is contained in:
Erik de Castro Lopo 2012-03-10 18:34:21 +11:00
parent e4f207d8a1
commit 51ed3d5eef

View File

@ -20,14 +20,16 @@ user=`git config --global user.email`
year=`date +"%Y"` year=`date +"%Y"`
missing_copyright_year="" missing_copyright_year=""
for f in $files ; do if test $user = "erikd@mega-nerd.com" ; then
if test `head -5 $f | grep -c -i copyright` -gt 0 ; then for f in $files ; do
user_copyright=`grep -i copyright $f | grep $user | grep -c $year` if test `head -5 $f | grep -c -i copyright` -gt 0 ; then
if test $user_copyright -lt 1 ; then user_copyright=`grep -i copyright $f | grep $user | grep -c $year`
missing_copyright_year="$missing_copyright_year $f" if test $user_copyright -lt 1 ; then
missing_copyright_year="$missing_copyright_year $f"
fi
fi fi
fi done
done fi
if test -n "$missing_copyright_year" ; then if test -n "$missing_copyright_year" ; then
echo "Missing current year in the copyright notice of the following files:" echo "Missing current year in the copyright notice of the following files:"