Script `update_repos.sh` has hardcoded `master` branch which breaks for some repos which use `main`.
thoward opened this issue · comments
Problem description
The script update_repos.sh
, on lines #77 & 78 has a hardcoded reference to the master
branch. Many repos use an preferred naming convention of main
(example: pulumi-tls. This means the git checkout
and git pull origin
commands will not work as expected if the target repo is using the main
naming convention, meaning that after the initial clone, updates may not be seen for those repo's docs.
Suggestions for a fix
Rather than hardcoding the branch name, derive it using the following command, saving the output into a variable. Refer to the variable in the git command rather than a hardcoded string:
git symbolic-ref refs/remotes/origin/HEAD | cut -d'/' -f4
Additionally, I suggest auditing other code to see if there are other places where the primary branch is assumed to be named master
.