1
0
forked from mirrors/0ad

Allow --fix in copyright linter wrapper

Sometimes doing it manually is cumbersome.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
Ralph Sennhauser
2025-07-01 13:37:17 +02:00
parent 0f39dcf2c3
commit 904957c50f
+5 -1
View File
@@ -14,6 +14,9 @@ while [ "$#" -gt 0 ]; do
git checkout --quiet "${to_commitish}" git checkout --quiet "${to_commitish}"
shift shift
;; ;;
--fix)
fix=--fix
;;
-j*) ;; -j*) ;;
*) *)
printf "Unknown option: %s\n\n" "$1" printf "Unknown option: %s\n\n" "$1"
@@ -34,9 +37,10 @@ fi
if [ -n "${diff}" ]; then if [ -n "${diff}" ]; then
for sha in $(git rev-list "${diff}"); do for sha in $(git rev-list "${diff}"); do
# shellcheck disable=SC2086
git diff-tree --no-commit-id --name-status -r "${sha}" | git diff-tree --no-commit-id --name-status -r "${sha}" |
awk '!/^D/{$1=""; printf "%s\0", substr($0,2)}' | awk '!/^D/{$1=""; printf "%s\0", substr($0,2)}' |
xargs -0 -L100 ./source/tools/lint/copyright/check_copyright_year.py xargs -0 -L100 ./source/tools/lint/copyright/check_copyright_year.py ${fix}
done done
else else
echo "WARNING: running copyright linter without base commit, likely not what you want." echo "WARNING: running copyright linter without base commit, likely not what you want."