fix branch check in CI (#5326)

Use explicit refs to avoid occasional issues with branch check reporting
incorrectly that commit is not an ancestor of upstream head.
This commit is contained in:
Etan Kissling 2023-08-19 22:49:52 +02:00 committed by GitHub
parent ad60ba027d
commit bee0342f35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -222,11 +222,11 @@ jobs:
echo "Submodule '$file': '.gitmodules' lacks 'branch' entry" echo "Submodule '$file': '.gitmodules' lacks 'branch' entry"
exit 2 exit 2
fi fi
if ! error="$(git -C "$file" fetch -q origin "$branch")"; then if ! error="$(git -C "$file" fetch -q origin "+refs/heads/$branch:refs/remotes/origin/$branch")"; then
echo "Submodule '$file': Failed to fetch '$branch': $error" echo "Submodule '$file': Failed to fetch '$branch': $error"
exit 2 exit 2
fi fi
if ! git -C "$file" merge-base --is-ancestor "$commit" "origin/$branch"; then if ! git -C "$file" merge-base --is-ancestor "$commit" "refs/remotes/origin/$branch"; then
echo "Submodule '$file': '$commit' is not on '$branch'" echo "Submodule '$file': '$commit' is not on '$branch'"
exit 2 exit 2
fi fi