1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-06-09 17:46:29 +09:00

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.
This commit is contained in:
Wolfgang Walther 2025-05-28 12:39:32 +02:00
parent ad4b36d2d2
commit e2a3792169
No known key found for this signature in database
GPG key ID: B39893FA5F65CAE1

View file

@ -14,9 +14,7 @@ cd "$(dirname "${BASH_SOURCE[0]}")"
PICKABLE_BRANCHES=${PICKABLE_BRANCHES:-master staging release-??.?? staging-??.??} PICKABLE_BRANCHES=${PICKABLE_BRANCHES:-master staging release-??.?? staging-??.??}
problem=0 problem=0
commits="$(git rev-list \ commits="$(git rev-list -E -i --grep="cherry.*[0-9a-f]{40}" --reverse "$1..$2")"
-E -i --grep="cherry.*[0-9a-f]{40}" --reverse \
"$1..$2")"
while read new_commit_sha ; do while read new_commit_sha ; do
if [ -z "$new_commit_sha" ] ; then if [ -z "$new_commit_sha" ] ; then
@ -45,6 +43,8 @@ while read new_commit_sha ; do
for branch_pattern in $PICKABLE_BRANCHES ; do for branch_pattern in $PICKABLE_BRANCHES ; do
set +f # re-enable pathname expansion set +f # re-enable pathname expansion
branches="$(git for-each-ref --format="%(refname)" "refs/remotes/origin/$branch_pattern")"
while read -r picked_branch ; do while read -r picked_branch ; do
if git merge-base --is-ancestor "$original_commit_sha" "$picked_branch" ; then if git merge-base --is-ancestor "$original_commit_sha" "$picked_branch" ; then
echo "$original_commit_sha present in branch $picked_branch" echo "$original_commit_sha present in branch $picked_branch"
@ -79,11 +79,7 @@ while read new_commit_sha ; do
# move on to next commit # move on to next commit
continue 3 continue 3
fi fi
done <<< "$( done <<< "$branches"
git for-each-ref \
--format="%(refname)" \
"refs/remotes/origin/$branch_pattern"
)"
done done
if [ "$GITHUB_ACTIONS" = 'true' ] ; then if [ "$GITHUB_ACTIONS" = 'true' ] ; then