From 8d57e91971cc5d4f36bcac31ce7ea8260177e6be Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Fri, 11 May 2012 17:43:13 -0600 Subject: [PATCH] add script for updating copyright years based on most recent Git commit --- update-copyright.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 update-copyright.sh diff --git a/update-copyright.sh b/update-copyright.sh new file mode 100644 index 0000000000..994addef38 --- /dev/null +++ b/update-copyright.sh @@ -0,0 +1,12 @@ +for x in $(find -name *.S -or -name *.cpp -or -name *.h -or -name *.java | sort); do + year_of_last_change=$(git log -1 --format=format:"%ai" $x | cut -c 1-4) + copyright_years=$(grep "^/\* Copyright (c) .*, Avian Contributors$" $x | sed "s-^/\* Copyright (c) \(.*\), Avian Contributors\$-\1-") + if [ "$copyright_years" != "" ]; then + first_copyright_year=$(echo "$copyright_years" | sed "s/\(.*\)-.*/\1/") + last_copyright_year=$(echo "$copyright_years" | sed "s/.*-\(.*\)/\1/") + if [ "$last_copyright_year" != "$year_of_last_change" ]; then + echo "$first_copyright_year-$year_of_last_change $x" + sed -i "s:^/\* Copyright (c) .*, Avian Contributors\$:/* Copyright (c) $first_copyright_year-$year_of_last_change, Avian Contributors:" $x + fi + fi +done