diff options
author | Alexis Hildebrandt <afh@surryhill.net> | 2022-07-01 11:35:49 +0200 |
---|---|---|
committer | Martin Michlmayr <tbm@cyrius.com> | 2022-07-02 13:47:02 +0800 |
commit | b789196386458e33d124198c59683b9708ed2283 (patch) | |
tree | 5d4e3eb0f7d55a42ffebe419be290aa9edeef54b /tools/update_copyright_year.sh | |
parent | 18305fd30df731e27b6e909ea7d846b579f0abc4 (diff) | |
download | fork-ledger-b789196386458e33d124198c59683b9708ed2283.tar.gz fork-ledger-b789196386458e33d124198c59683b9708ed2283.tar.bz2 fork-ledger-b789196386458e33d124198c59683b9708ed2283.zip |
Improve update copyright year script
Diffstat (limited to 'tools/update_copyright_year.sh')
-rwxr-xr-x | tools/update_copyright_year.sh | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tools/update_copyright_year.sh b/tools/update_copyright_year.sh index ab08a947..a669a83f 100755 --- a/tools/update_copyright_year.sh +++ b/tools/update_copyright_year.sh @@ -26,11 +26,15 @@ # SOFTWARE. YEAR=${1:-$(date +%Y)} -# egrep is rather slow, but the much faster ag (the-silver-searcher) -# is not generally installed -GREP=${2:-egrep} -${GREP} -Rl 'Copyright.*Wiegley' $(git ls-files | cut -d / -f1 | uniq) \ +# Use ag (the-silver-searcher) when available as it is much faster than +# the venerable egrep +GREP=$(command -v ag || command -v egrep) + +git ls-files -z \ + | xargs -0 ${GREP} -Rl 'Copyright.*Wiegley' \ + | uniq \ | ${GREP} -v "(test/regress/25A099C9.dat|$(basename $0))" \ - | xargs sed -i '' -e "s/\(Copyright.*\)-20[0-9]\{2\}/\1-${YEAR}/" + | xargs sed -i '' -e "s/\(Copyright.*\)-20[0-9]\{2\}/\1-${YEAR}/" \ + # git ls-files | xargs grep | uniq | grep -v | xargs sed |