util/scripts/update_submodules: Rework default branch detection

Instead of guessing the default branch by iterating over a list of
branch names, use the branch that is configured as default by upstream.

Change-Id: I628b5a4e5228870c54719577e32dae169b0ceb2e
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/86803
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
This commit is contained in:
Felix Singer 2025-03-11 01:36:09 +01:00
commit d6caf33c6f

View file

@ -108,13 +108,7 @@ main() {
git fetch 2>/dev/null
fi
declare -a branches=("origin/main" "origin/master" "origin/trunk")
for branch in "${branches[@]}"; do
if git branch -a | grep "${branch}" > /dev/null; then
branch_name="${branch}"
break
fi
done
branch_name="$(git symbolic-ref refs/remotes/origin/HEAD --short)"
updated_commit_id="$(git log --pretty='%h' -n 1 --abbrev=12 "${branch_name}" -- )"
updated_commit_description="$(git log --pretty='%ci - (%s)' -n 1 "${updated_commit_id}")"