Support master branch being renamed to main

Fixes:
```
70run-post-tasks: invoking /var/cache/cosmos/model/post-tasks.d/018packages
Your configuration specifies to merge with the ref 'refs/heads/master'
from the remote, but no such ref was fetched.
```
This commit is contained in:
Patrik Lundin 2023-01-31 08:19:41 +01:00
parent 4601e0bf08
commit e212b6f56f
Signed by: patlu
GPG key ID: A0A812BA2249F294

View file

@ -42,6 +42,8 @@ if [ -f $CONFIG -o $LOCALCONFIG ]; then
if [ "$src" != "$(git config remote.origin.url)" ]; then
git config remote.origin.url $src
fi
# Support master branch being renamed to main
git branch --all | grep -q '^[[:space:]]*remotes/origin/main$' && git checkout main
# Update repo and clean out any local inconsistencies
git pull -q || (git fetch && git reset --hard)
else