|
|
|
@ -2,21 +2,21 @@
|
|
|
|
|
|
|
|
|
|
fail=0
|
|
|
|
|
|
|
|
|
|
git fetch origin master
|
|
|
|
|
git fetch origin main
|
|
|
|
|
|
|
|
|
|
# list all commits between HEAD and master
|
|
|
|
|
for commit in $(git rev-list origin/master..)
|
|
|
|
|
# list all commits between HEAD and main
|
|
|
|
|
for commit in $(git rev-list origin/main..)
|
|
|
|
|
do
|
|
|
|
|
message=$(git log -n1 --format=%B $commit)
|
|
|
|
|
echo "Checking $commit"
|
|
|
|
|
|
|
|
|
|
# The commit message must contain either
|
|
|
|
|
# 1. "cherry-picked from [some commit in master]"
|
|
|
|
|
# 1. "cherry-picked from [some commit in main]"
|
|
|
|
|
if [[ $message =~ "(cherry picked from commit" ]]; then
|
|
|
|
|
# remove last ")" and extract commit hash
|
|
|
|
|
master_commit=$(echo ${message:0:-1} | tr ' ' '\n' | tail -1)
|
|
|
|
|
# check if master really contains this commit hash
|
|
|
|
|
if [[ $(git branch -a --contains $master_commit | grep --only-matching "remotes/origin/master") == "remotes/origin/master" ]]; then
|
|
|
|
|
main_commit=$(echo ${message:0:-1} | tr ' ' '\n' | tail -1)
|
|
|
|
|
# check if main really contains this commit hash
|
|
|
|
|
if [[ $(git branch -a --contains $main_commit | grep --only-matching "remotes/origin/main") == "remotes/origin/main" ]]; then
|
|
|
|
|
continue
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|