Skip to content

Commit f5b6d26

Browse files
rjriajulpzhlkj6612
andcommitted
Fix default branch detection
Co-authored-by: Mozi <29089388+pzhlkj6612@users.noreply.github.com>
1 parent 7dee79a commit f5b6d26

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

util/update_scripts.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ echo "Processing ${scr}"
6767
else
6868
if [[ -z "${CUR_BRANCH}" ]]; then
6969
# Fetch default branch name
70-
CUR_BRANCH="$(git remote show "${CUR_REPO}" | grep "HEAD branch:" | cut -d":" -f2 | xargs)"
70+
CUR_BRANCH="$(git ls-remote --symref --exit-code "${CUR_REPO}" HEAD | awk '/^ref:/ {print $2}' | sed 's|refs/heads/||')"
7171
echo "Found default branch ${CUR_BRANCH}"
7272
fi
7373
NEW_COMMIT="$(git ls-remote --exit-code --heads --refs "${CUR_REPO}" refs/heads/"${CUR_BRANCH}" | cut -f1)"

0 commit comments

Comments
 (0)