mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: pre-commit-hook: update copyright date checking
This commit is contained in:
@ -3,7 +3,7 @@
|
|||||||
# ========= |
|
# ========= |
|
||||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
# \\ / O peration |
|
# \\ / O peration |
|
||||||
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
# \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
# \\/ M anipulation |
|
# \\/ M anipulation |
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
@ -268,7 +268,7 @@ checkLineLengthNonDirective()
|
|||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# check that OpenFOAM Foundation copyright is currents
|
# check that OpenFOAM Foundation copyright is current
|
||||||
#
|
#
|
||||||
checkCopyright()
|
checkCopyright()
|
||||||
{
|
{
|
||||||
@ -277,12 +277,28 @@ checkCopyright()
|
|||||||
|
|
||||||
for f in $fileList
|
for f in $fileList
|
||||||
do
|
do
|
||||||
sYear=`grep "Copyright.*OpenFOAM" $f | sed 's/[^0-9]//g'`
|
startYear=`grep "Copyright.*OpenFOAM" $f | sed 's/[^0-9]*\([0-9]*\).*/\1/g'`
|
||||||
if [ "$sYear" != "" ] && [ "$year" != "$sYear" ]; then
|
endYear=`grep "Copyright.*-.*OpenFOAM" $f | sed 's/[^-]*-\([0-9]*\).*/\1/g'`
|
||||||
echo "Updated copyright for: $f"
|
#echo "startYear=$startYear endYear=$endYear"
|
||||||
sed -i "s/$sYear OpenFOAM/$year OpenFOAM/g" $f
|
if [ "$startYear" != "" ]
|
||||||
|
then
|
||||||
|
if [ "$endYear" != "" ]
|
||||||
|
then
|
||||||
|
# Date is of type 2011-2012 OpenFOAM Foundation
|
||||||
|
if [ "$year" != "$endYear" ]
|
||||||
|
then
|
||||||
|
echo "Updated copyright for: $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"
|
||||||
|
sed -i "s/$startYear OpenFOAM/$startYear-$year OpenFOAM/g" $f
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user