11#! /bin/bash
2- # Ensure commits in beta are in master & commits in stable are in beta + master.
2+ # Ensure commits in beta are in the default branch & commits in stable are in beta + the default
3+ # branch.
34set -euo pipefail
45IFS=$' \n\t '
56
@@ -19,11 +20,11 @@ verify_backported_commits_main() {
1920 fi
2021
2122 if [[ $ci_base_branch == " beta" ]]; then
22- verify_cherries master " $BETA_LIMIT " \
23+ verify_cherries HEAD " $BETA_LIMIT " \
2324 || exit 1
2425
2526 elif [[ $ci_base_branch == " stable" ]]; then
26- (verify_cherries master " $STABLE_LIMIT " \
27+ (verify_cherries HEAD " $STABLE_LIMIT " \
2728 & verify_cherries beta " $STABLE_LIMIT " ) \
2829 || exit 1
2930
@@ -64,7 +65,7 @@ verify_cherries() {
6465 continue
6566 fi
6667
67- if ! is_in_master " $backport_sha " ; then
68+ if ! is_in_default_branch " $backport_sha " ; then
6869 bad_backports+=(" $sha " )
6970 continue
7071 fi
@@ -85,7 +86,7 @@ verify_cherries() {
8586 done
8687 echo
8788 echo " do not match any commits in \` $1 \` . If this was intended, add the text"
88- echo ' \`backport-of: <SHA of a commit already in master >\`'
89+ echo ' \`backport-of: <SHA of a commit already in the default branch >\`'
8990 echo ' somewhere in the message of each of these commits.'
9091 echo
9192 failure=1
@@ -101,7 +102,7 @@ verify_cherries() {
101102 done
102103 echo
103104 echo ' have commit messages marked \`backport-of: <SHA>\`, but the SHA is not in'
104- echo ' \`master\` .'
105+ echo ' the default branch .'
105106 echo
106107 failure=1
107108 fi
@@ -132,11 +133,11 @@ get_backport() {
132133 | sed -n ' /^.*backport-of:\s\?\([a-f0-9]\+\|nothing\).*/{s//\1/p;q}'
133134}
134135
135- # Check if a commit is in master .
136+ # Check if a commit is in the default branch .
136137#
137138# $1 = <sha>
138- is_in_master () {
139- git merge-base --is-ancestor " $1 " origin/master 2> /dev/null
139+ is_in_default_branch () {
140+ git merge-base --is-ancestor " $1 " origin/HEAD 2> /dev/null
140141}
141142
142143verify_backported_commits_main
0 commit comments