Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
FredDeschenes opened this issue Oct 14, 2020 · 8 comments

Comments

@FredDeschenes
Copy link

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 Use user-provided version of zsh #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).

@acidghost
Copy link

@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
Copy link

reegnz commented Nov 19, 2021

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
Copy link

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

@unixorn
Copy link
Contributor

unixorn commented Jan 13, 2022

FWIW, you can detect the default branch with

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

gerardbosch added a commit to gerardbosch/fzf-zsh-plugin that referenced this issue Feb 22, 2022
Until zsh-users/antigen#717 gets fixed, the
branch needs to be specified when this is not `master`.

Signed-off-by: Gerard Bosch <gerard.bosch@gmail.com>
@dylan-chong
Copy link

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

@aredridel
Copy link

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

@unixorn
Copy link
Contributor

unixorn commented Oct 26, 2022

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 added a commit to unixorn/git-extra-commands that referenced this issue Oct 26, 2022
Antigen doesn't cope when the default branch of a repo is not named
`master` - see zsh-users/antigen#717

Update the install instructions in the readme accordingly.

Signed-off-by: Joe Block <jpb@unixorn.net>
@gko
Copy link

gko commented Jul 18, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants