From ac8027c43c9df4431092d633a06bd5bd92341247 Mon Sep 17 00:00:00 2001 From: Yogeswaran Umasankar Date: Sat, 20 Jan 2024 20:24:55 +0000 Subject: New upstream version 1:20240117 --- tools/check_commit.sh | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'tools/check_commit.sh') 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 -- cgit v1.2.3