summaryrefslogtreecommitdiff
path: root/tools/check_commit.sh
diff options
context:
space:
mode:
authorYogeswaran Umasankar <kd8mbd@gmail.com>2024-01-20 20:25:00 +0000
committerYogeswaran Umasankar <kd8mbd@gmail.com>2024-01-20 20:25:00 +0000
commite5ac17f663e108f458b5e3d34bfcc85b2d0482bc (patch)
tree13f52b05b717ade7f8ba982ee1d910834067c0c6 /tools/check_commit.sh
parentf5e142a4e54bfda24bec40e923c643b434948a04 (diff)
parentac8027c43c9df4431092d633a06bd5bd92341247 (diff)
Update upstream source from tag 'upstream/1%20240117'
Update to upstream version '1:20240117' with Debian dir 8d8fe4e002b178241b01b8f9b69615aa2480698f
Diffstat (limited to 'tools/check_commit.sh')
-rwxr-xr-xtools/check_commit.sh23
1 files changed, 14 insertions, 9 deletions
diff --git a/tools/check_commit.sh b/tools/check_commit.sh
index 6158a47..5a86e33 100755
--- a/tools/check_commit.sh
+++ b/tools/check_commit.sh
@@ -65,30 +65,35 @@ for file in $(git diff --name-only ${BASE}..); do
fi
done
+#if grep 'def match_model' added_lines; then
+# fail 'New drivers should not have match_model() implemented as it is not needed'
+#fi
+
if git log ${BASE}.. --merges | grep .; then
fail Please do not include merge commits in your PR
fi
make -C chirp/locale clean all >/dev/null 2>&1
-if git diff chirp/locale | grep '^\+[^#+]' | grep -v POT-Creation; then
+if git diff chirp/locale | grep '^+[^#+]' | grep -v POT-Creation; then
fail Locale files need updating
fi
-added_files=$(git diff --name-only --diff-filter=A ${BASE}.. 2>&1)
-if echo $added_files | grep -q chirp.drivers && ! echo $added_files | grep -q tests.images; then
+added_files=$(git diff --name-only --diff-filter=A ${BASE}..)
+added_py=$(git diff --name-only --diff-filter=A ${BASE}.. | grep '\.py$')
+if echo $added_py | grep -q chirp.drivers && ! echo $added_files | grep -q tests.images; then
fail All new drivers should include a test image
fi
existing_drivers=$(git ls-tree --name-only $BASE chirp/drivers/)
-limit=20
-for nf in $added_files; do
+limit=51
+for nf in $added_py; do
for of in $existing_drivers; do
- change=$(wdiff -s $of $nf | grep -I $of | sed -r 's/.* ([0-9]+)% changed/\1/')
- if [ ! "$change" ]; then
+ common=$(wdiff -s $of $nf | grep -I $nf | sed -r 's/.* ([0-9]+)% common.*/\1/')
+ if [ ! "$common" ]; then
continue
fi
- if [ "$change" -lt "$limit" ]; then
- fail "New file $nf shares at least $((100 - $change))% with $of!"
+ if [ "$common" -gt "$limit" ]; then
+ fail "New file $nf shares at least ${common}% with $of!"
fi
done
done