mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: pre-commit-hook: abort upon bad date.
This commit is contained in:
@ -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"
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user