Skip to content

Commit ab9aa32

Browse files
authored
Also check the copyright line without date (#857)
Following on a Gemini idea.
1 parent fcc07bc commit ab9aa32

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

scripts/ci-copyright.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ set -e
2222
notice() {
2323
local file="$1"
2424
local start prefix
25-
start=$(sed -n '/ Copyright/{1q2;2q3}' "$file" || echo $?)
26-
[ -n "$start" ] || return
27-
prefix="$(sed -n 's/ Copyright.*//p;T;q' "$file")"
25+
start=$(sed -n '/ Copyright/{=;q}' "$file")
26+
[ "${start:-3}" -lt 3 ] || return
27+
prefix="$(sed -n "$start"'s/ Copyright.*//p' "$file")"
2828
case "$prefix" in
2929
'//') prefix='\/\/' ;;
3030
esac
31-
sed -n "$start"',+12{/^\('"$prefix"'\|$\)/!d;s/^'"$prefix"'/#/;p}' "$file"
31+
sed -n "$start"'s/\(Copyright\) ..../\1/;'\
32+
"$start"',+13{/^\('"$prefix"'\|$\)/!d;s/^'"$prefix"'/#/;p}' "$file"
3233
}
3334

3435
REFERENCE_NOTICE="$(notice $0)"

0 commit comments

Comments
 (0)