1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/mirrors-Spring-Framework_old1

Клонировать/Скачать
update_copyright_headers.sh 961 Байт
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
Sam Brannen Отправлено 19.02.2023 15:37 bb6150e
#!/bin/sh
#
# This shell script updates the copyright headers in source code files
# in the current branch that have been added or modified during the
# current year (at least as much as the `git diff` command supports the
# date range in terms of log history).
#
# This has only been tested on mac OS.
current_year=$(date +'%Y')
echo Updating copyright headers in Java, Kotlin, and Groovy source code for year $current_year
# Added/Modified this year and committed
for file in $(git --no-pager diff --name-only --diff-filter=AM @{$current_year-01-01}..@{$current_year-12-31} | egrep "^.+\.(java|kt|groovy)$" | uniq); do
sed -i '' -E "s/Copyright 2002-[0-9]{4}/Copyright 2002-$current_year/g" $file;
done
# Added/Modified and staged but not yet committed
for file in $(git --no-pager diff --name-only --diff-filter=AM --cached | egrep "^.+\.(java|kt|groovy)$" | uniq); do
sed -i '' -E "s/Copyright 2002-[0-9]{4}/Copyright 2002-$current_year/g" $file;
done

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/mirrors-Spring-Framework_old1.git
git@api.gitlife.ru:oschina-mirror/mirrors-Spring-Framework_old1.git
oschina-mirror
mirrors-Spring-Framework_old1
mirrors-Spring-Framework_old1
main