asdf-vm/asdf

bug: Do not hardcode `master` branch

hyperupcall opened this issue · 0 comments

Describe the Bug

Various parts of the code operate under the assumption that the default branch is the master branch. For example, in command-update.bash:

...
if [ "$update_to_head" = "--head" ]; then
    # Update to latest on the master branch
    git fetch origin master
    git checkout master
    git reset --hard origin/master
    printf "Updated asdf to latest on the master branch\n"
...

As more and more people use main (GitHub now defaults to main), things will either break or require extra work to manually provide the default branch name.

This is related to #974 (which was eventually closed by the OP). Inspired by #1694, which fixes some instances (but not all). It would be a good idea to implement this functionality within a function in utils.bash.

Steps to Reproduce

N/A

Expected Behaviour

To intelligently determine the branch name.

Actual Behaviour

Assumes master

Environment

N/A

asdf plugins affected (if relevant)

N/A