-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
echo "Checking source file for broadcom proprietary files..." | ||
pattern1='BRCM:[0-9]+:proprietary:' | ||
pattern2='BRCM:[0-9]+:NONE:RED' | ||
|
||
files=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(c|h)$') | ||
|
||
if [ -z "$files" ]; then | ||
# No .c or .h files staged, exit successfully | ||
exit 0 | ||
fi | ||
|
||
echo "Checking files:" | ||
for file in $files; do | ||
echo "* $file" | ||
if git show ":$file" | grep -Eq "$pattern1|$pattern2"; then | ||
echo "Error: File '$file' contains forbidden patterns." | ||
echo "Patterns:" | ||
echo " - $pattern1" | ||
echo " - $pattern2" | ||
echo "Commit aborted." | ||
exit 1 | ||
fi | ||
done | ||
|
||
# If no matches are found, allow the commit | ||
exit 0 |