antigen icon indicating copy to clipboard operation
antigen copied to clipboard

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

Open FredDeschenes opened this issue 3 years ago • 8 comments

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

  • antigen version Antigen develop (d1dd78b) Revision date: 2018-01-15 14:37:21 -0300
  • zsh --version zsh 5.8 (x86_64-ubuntu-linux-gnu)
  • uname -a Linux poste-0948 5.4.0-51-generic #56-Ubuntu SMP Mon Oct 5 14:28:49 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Configuration

  • gist of .antigenrc Not used
  • gist of .zshrc Entire file is here, but line 69 is where my theme that causes the issue is set.

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).

FredDeschenes avatar Oct 14 '20 20:10 FredDeschenes

@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

acidghost avatar Aug 18 '21 09:08 acidghost

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.

reegnz avatar Nov 19 '21 10:11 reegnz

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

philoserf avatar Jan 13 '22 17:01 philoserf

FWIW, you can detect the default branch with

git remote show origin | awk '$0 ~ \"HEAD branch\" {print $NF}'

unixorn avatar Jan 13 '22 19:01 unixorn

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

dylan-chong avatar Jul 28 '22 22:07 dylan-chong

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

aredridel avatar Oct 26 '22 15:10 aredridel

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.

unixorn avatar Oct 26 '22 15:10 unixorn

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

gko avatar Jul 18 '23 11:07 gko