Skip to content

Commit e2a3792

Browse files
ci/check-cherry-picks: improve error handling
We recently moved the $commits variable out of a "subshell in a herestring", let's do the same for the list of branches, where errors would be silently swallowed as well. Also reformat the expressions slightly, we have enough line-length.
1 parent ad4b36d commit e2a3792

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

ci/check-cherry-picks.sh

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ cd "$(dirname "${BASH_SOURCE[0]}")"
1414
PICKABLE_BRANCHES=${PICKABLE_BRANCHES:-master staging release-??.?? staging-??.??}
1515
problem=0
1616

17-
commits="$(git rev-list \
18-
-E -i --grep="cherry.*[0-9a-f]{40}" --reverse \
19-
"$1..$2")"
17+
commits="$(git rev-list -E -i --grep="cherry.*[0-9a-f]{40}" --reverse "$1..$2")"
2018

2119
while read new_commit_sha ; do
2220
if [ -z "$new_commit_sha" ] ; then
@@ -45,6 +43,8 @@ while read new_commit_sha ; do
4543
for branch_pattern in $PICKABLE_BRANCHES ; do
4644
set +f # re-enable pathname expansion
4745

46+
branches="$(git for-each-ref --format="%(refname)" "refs/remotes/origin/$branch_pattern")"
47+
4848
while read -r picked_branch ; do
4949
if git merge-base --is-ancestor "$original_commit_sha" "$picked_branch" ; then
5050
echo "$original_commit_sha present in branch $picked_branch"
@@ -79,11 +79,7 @@ while read new_commit_sha ; do
7979
# move on to next commit
8080
continue 3
8181
fi
82-
done <<< "$(
83-
git for-each-ref \
84-
--format="%(refname)" \
85-
"refs/remotes/origin/$branch_pattern"
86-
)"
82+
done <<< "$branches"
8783
done
8884

8985
if [ "$GITHUB_ACTIONS" = 'true' ] ; then

0 commit comments

Comments
 (0)