Skip to content

Commit e04f324

Browse files
authored
[CI] Handle empty list in check_copyright.sh (#11647)
- Added handling for an empty list of files with invalid copyright declarations. - Fixed indentation to 2 spaces.
1 parent a4ee260 commit e04f324

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

scripts/check_copyright.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ list=$(git grep "${options[@]}" -- \
2727
':(exclude)**/third_party/**')
2828

2929
# Allow copyrights before 2020 without LLC.
30-
result=$(grep -L 'Copyright 20[0-1][0-9].*Google' $list)
30+
if [[ $list ]]; then
31+
result=$(grep -L 'Copyright 20[0-1][0-9].*Google' "$list")
32+
fi
3133

3234
if [[ $result ]]; then
33-
echo "$result"
34-
echo "ERROR: Missing copyright notices in the files above. Please fix."
35-
exit 1
35+
echo "$result"
36+
echo "ERROR: Missing copyright notices in the files above. Please fix."
37+
exit 1
3638
fi

0 commit comments

Comments
 (0)