Github allows users to change the default branch name from master. Packer doesn't currently support main as a branch name:
✗ Failed to update jamessan/vim-gnupg
Errors:
fatal: invalid reference: master
fatal: invalid reference: master
90b86c5
So, you can work around this by using packer's "branch" feature, e.g. use {'jamessan/vim-gnupg', branch = 'main'} should work. But that is a lot of extra noise if you have many plugin repos which use main (or something else) as their default branch name.
Do you think it would be helpful to provide a new setting for the default "default branch name"? Other than that, I'm not sure there's a way to get around specifying the branch name plugin-by-plugin.
Do you think it would be helpful to provide a new setting for the default "default branch name"? Other than that, I'm not sure there's a way to get around specifying the branch name plugin-by-plugin.
Why not make the inclusion of a specific branch (ref, etc) on the clone command conditional based on whether or not a branch is provided? If there's not a specified branch, don't clone a specific branch. I'm looking through vim-plug and that seems to be the approach there. There are probably some side effects in terms of how updates would need to work, but this seems like the more future-proof approach. Especially considering the rising adoption of main.
@timbedard Ok, that seems like a reasonable solution. The trick will be in detecting what to check out if a plugin spec changes branches, e.g. if a user initially specifies use {'foo/bar', branch = 'baz'}, but later changes their spec to use {'foo/bar'}. That's the main place packer uses master as the "default" branch name.
It looks like vim-plug handles this by reading ${GIT_DIR}/refs/remotes/origin/HEAD; this is probably the right thing to do.
@sunjon and others: this should be fixed now, but please let me know if you still encounter errors (or encounter new errors this change may have introduced). Thanks!
@wbthomason Nicely (and quickly) done! Working great. Thanks!