From b8f3975d3641fad19971cc159bdb9decb6ea95f8 Mon Sep 17 00:00:00 2001 From: Elod Illes Date: Fri, 12 Jul 2024 22:53:06 +0200 Subject: [PATCH] [tools] Ignore bot generated patches This is a fix for the test whether a patch is bot generated or not, as that did not worked as intended. The problem is that the script is checking the email address of the parent patch (HEAD~), which probably should be right in case the patch would be a MERGE patch. But this is wrong in case the patch is not a MERGE patch. This fix uses the very same pattern as it is using for the commit message parsing: the $commit_hash variable, which is the parent's commit hash if the patch is a MERGE patch, and an empty string in the other case (causing to call 'git show' on HEAD). Change-Id: I0abc72180edf34a6dd0624a40fb8682397805eca --- tools/check-cherry-picks.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/check-cherry-picks.sh b/tools/check-cherry-picks.sh index 3042aa165932..439f42df3afc 100755 --- a/tools/check-cherry-picks.sh +++ b/tools/check-cherry-picks.sh @@ -14,7 +14,7 @@ if [ $parent_number -eq 2 ]; then commit_hash=$(git show --format='%P' --quiet | awk '{print $NF}') fi -if git show --format='%aE' HEAD~ --quiet | grep -qi 'infra-root@openstack.org'; then +if git show --format='%aE' --quiet $commit_hash | grep -qi 'infra-root@openstack.org'; then echo 'Bot generated change; ignoring' exit 0 fi