Merge "Fix cherry-pick check for merge patch" into stable/train

This commit is contained in:
Zuul 2020-07-08 15:30:45 +00:00 committed by Gerrit Code Review
commit 5e36e91bb2
1 changed files with 11 additions and 1 deletions

View File

@ -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