summaryrefslogtreecommitdiff
path: root/tools/check_commit.sh
diff options
context:
space:
mode:
authorDave Hibberd <d@vehibberd.com>2024-01-23 00:30:05 +0000
committerDave Hibberd <d@vehibberd.com>2024-01-23 00:30:05 +0000
commit691b1b410562075e0d76033f5c8ddaf1da7344d0 (patch)
treef183304481dc93719dec8c121cd1280822b2da4e /tools/check_commit.sh
parentaed54358fee5927f9b4913566d84b92255e08e12 (diff)
parentac8027c43c9df4431092d633a06bd5bd92341247 (diff)
Merge branch 'upstream' into 'upstream'
New upstream version 1:20240117 See merge request debian-hamradio-team/chirp!5
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