+8
-1
ci/check-cherry-picks.sh
+8
-1
ci/check-cherry-picks.sh
···
46
46
for pattern in $PICKABLE_BRANCHES ; do
47
47
set +f # re-enable pathname expansion
48
48
49
-
branches="$(git for-each-ref --format="%(refname)" "refs/remotes/${remote:-origin}/$pattern")"
49
+
# Reverse sorting by refname and taking one match only means we can only backport
50
+
# from unstable and the latest stable. That makes sense, because even right after
51
+
# branch-off, when we have two supported stable branches, we only ever want to cherry-pick
52
+
# **to** the older one, but never **from** it.
53
+
# This makes the job significantly faster in the case when commits can't be found,
54
+
# because it doesn't need to iterate through 20+ branches, which all need to be fetched.
55
+
branches="$(git for-each-ref --sort=-refname --format="%(refname)" \
56
+
"refs/remotes/${remote:-origin}/$pattern" | head -n1)"
50
57
51
58
while read -r picked_branch ; do
52
59
if git merge-base --is-ancestor "$original_commit_sha" "$picked_branch" ; then