diff --git a/bin/tools/pre-commit-hook b/bin/tools/pre-commit-hook index 1a8ae0181ad7b0ceaff823c5ae3b25b2e9d7262a..551af76c6ce41eeabc4868351e17ffe205237a2f 100755 --- a/bin/tools/pre-commit-hook +++ b/bin/tools/pre-commit-hook @@ -275,6 +275,7 @@ checkCopyright() year=$(date +%Y) echo "$hookName: check copyright ..." 1>&2 + badFiles=$( for f in $fileList do startYear=`grep "Copyright.*OpenFOAM" $f | sed 's/[^0-9]*\([0-9]*\).*/\1/g'` @@ -287,19 +288,24 @@ checkCopyright() # Date is of type 2011-2012 OpenFOAM Foundation if [ "$year" != "$endYear" ] then - echo "Updated copyright for: $f" + echo "Updated copyright for: $f" 1>&2 + echo "$f" sed -i "s/$startYear-$endYear OpenFOAM/$startYear-$year OpenFOAM/g" $f fi else # Date is of type 2011 OpenFOAM Foundation if [ "$year" != "$startYear" ] then - echo "Updated copyright for: $f" + echo "$f" + echo "Updated copyright for: $f" 1>&2 sed -i "s/$startYear OpenFOAM/$startYear-$year OpenFOAM/g" $f fi fi fi done + ) + + dieOnBadFiles "Some copyright dates were automatically updated; Please check these before pushing" }