Skip to content

Commit 6d2f944

Browse files
committed
scripts: log filename/pattern on matching failure
Signed-off-by: Casey Bodley <cbodley@redhat.com>
1 parent 06c6bbf commit 6d2f944

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

scripts/build_utils.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,7 +1768,10 @@ no_filenames_match() {
17681768
for f in $files; do
17691769
for p in $patterns; do
17701770
# add leading slash to simplify matching
1771-
if match_filename "/$f" "$p"; then return 1; fi
1771+
if match_filename "/$f" "$p"; then
1772+
echo "filename '$f' matched pattern '$p'"
1773+
return 1
1774+
fi
17721775
done
17731776
done
17741777
return 0
@@ -1777,9 +1780,8 @@ no_filenames_match() {
17771780
all_filenames_match() {
17781781
local files=$1
17791782
local patterns=$(codeowners_patterns_to_regex "$2")
1780-
# 0 is true, 1 is false
1781-
local all_match=0
17821783
for f in $files; do
1784+
# 0 is true, 1 is false
17831785
local match=1
17841786
for p in $patterns; do
17851787
# pattern loop: if one pattern matches, skip the others
@@ -1788,9 +1790,12 @@ all_filenames_match() {
17881790
done
17891791
# file loop: if this file matched no patterns, the group fails
17901792
# (one mismatch spoils the whole bushel)
1791-
if [[ $match -eq 1 ]] ; then all_match=1; break; fi
1793+
if [[ $match -eq 1 ]] ; then
1794+
echo "filename '$f' matched no patterns"
1795+
return 1
1796+
fi
17921797
done
1793-
return $all_match
1798+
return 0
17941799
}
17951800

17961801
docs_pr_only() {

0 commit comments

Comments
 (0)