zsh-users / antigen

The plugin manager for zsh.
http://antigen.sharats.me
MIT License
8.09k stars 280 forks source link

Antigen doesn't work with plugins whose repositories don't have a 'master' branch #717

Open FredDeschenes opened 4 years ago

FredDeschenes commented 4 years ago

Description

Title pretty much says it all. Antigen seems to rely on the fact that a repository has a 'master' branch and with Github's new default repository setup that uses 'main' instead (or any repository that changed their 'master' branch to 'main') installing/updating those plugins fails.

Steps to reproduce

Minimal steps to reproduce this behavior. Example:

1 - Use any theme/plugin that doesn't have a 'master' branch ([the theme I use](https://github.com/reobin/typewritten) is the one that was giving me issues)
2 - Run `antigen update`
    $ antigen update
    Updating reobin/typewritten@master... Error! Activate logging and try again.

Expected behavior:

- Plugins without a 'master' branch should work

Software version

Configuration

More information

As a workaround you can manually clone/update your plugins in $ANTIGEN_BUNDLES (Antigen still creates the directory structure, just doesn't perform the clone/pull).

acidghost commented 3 years ago

@FredDeschenes This is surely late, but you can specify a branch or tag you want to clone with antigen bundle (RTFM https://github.com/zsh-users/antigen/wiki/Commands).

Example: antigen bundle org/repo@main

reegnz commented 3 years ago

Would it make sense for antigen to just not assume the default branch of the repo is called master? It's somewhat user-hostile to have the user figure out what the default branch of a repo is, instead of infering it from the repo itself. Having any branch as the default branch is a git feature.

philoserf commented 2 years ago

FTR: Commonly used plugins from @unixorn have moved to main

unixorn commented 2 years ago

FWIW, you can detect the default branch with

git remote show origin | awk '$0 ~ \"HEAD branch\" {print $NF}'
dylan-chong commented 2 years ago

Would be really nice if at least we could have by default main as an accepted alternative to master

aredridel commented 2 years ago

Yes please! Especially since that's the default on modern git and github

unixorn commented 2 years ago

I think it's best to use git remote show origin | awk '$0 ~ \"HEAD branch\" {print $NF}' to find a given repo's default branch. Otherwise there will still be an issue when you come across a repo that used something like primary instead of main when they moved off of master.

gko commented 1 year ago

There is also a problem with already installed bundles. If you change the branch from master to main you have to update your config.

There is a way to get a default branch in git repo: https://github.com/gko/dotfiles/blob/491cb022e07e8ba20cd8cb90fce0fdaebc2439b0/.gitconfig#L62