summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2020-07-02 18:40:35 +0000
committerGerrit Code Review <review@openstack.org>2020-07-02 18:40:36 +0000
commit1c102141db2305ade598c5d58af9017e08113699 (patch)
tree3d405b88622f0feb2aa7276c1f472a733053838c /tools
parent2a0cc702023a56eb81b78f274fe12ccff1892145 (diff)
parentc7c48c6f52c9159767b60a4576ba37726156a5f7 (diff)
downloadnova-1c102141db2305ade598c5d58af9017e08113699.tar.gz
Merge "Fix cherry-pick check for merge patch"
Diffstat (limited to 'tools')
-rwxr-xr-xtools/check-cherry-picks.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/check-cherry-picks.sh b/tools/check-cherry-picks.sh
index 307837d2aa..32627e59b6 100755
--- a/tools/check-cherry-picks.sh
+++ b/tools/check-cherry-picks.sh
@@ -4,7 +4,17 @@
# to verify that they're all on either master or stable/ branches
#
-hashes=$(git show --format='%b' --quiet $1 | sed -nr 's/^.cherry picked from commit (.*).$/\1/p')
+commit_hash=""
+
+# Check if the patch is a merge patch by counting the number of parents.
+# If the patch has 2 parents, then the 2nd parent is the patch we want
+# to validate.
+parent_number=$(git show --format='%P' --quiet | awk '{print NF}')
+if [ $parent_number -eq 2 ]; then
+ commit_hash=$(git show --format='%P' --quiet | awk '{print $NF}')
+fi
+
+hashes=$(git show --format='%b' --quiet $commit_hash | sed -nr 's/^.cherry picked from commit (.*).$/\1/p')
checked=0
branches+=""
for hash in $hashes; do