Last active
January 11, 2021 09:20
Oracle OpenSource Utils: use to update copyright year in the updated files before commit.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
YEAR=$(date '+%Y') | |
if [ $# -gt 0 ] | |
then | |
rev=$1 | |
else | |
rev="$(git rev-list --boundary HEAD...master | grep "^-" | cut -c2-)...HEAD" | |
fi | |
echo $rev | |
while read f | |
do | |
echo $f | |
sed -i '' \ | |
"/Copyright (c) $YEAR, Oracle/"' !{ | |
s/Copyright (c) \([0-9]\{1,\}\), Oracle/Copyright (c) \1, '$YEAR', Oracle/ | |
s/Copyright (c) \([0-9]\{1,\}\), [0-9]\{1,\}, Oracle/Copyright (c) \1, '$YEAR', Oracle/ | |
}' $f | |
git diff $f | |
done < <(git diff --name-status --relative $rev . | grep -v "^D" | cut -f2- | sort -u) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment