zdharma-continuum / zinit

🌻 Flexible and fast ZSH plugin manager
MIT License
2.89k stars 125 forks source link

[bug]: self-update fails if default remote name is not "origin" #472

Open ghost opened 1 year ago

ghost commented 1 year ago

What happened?

I set clone.defaultRemoteName = root in .gitconfig because I like the tree imagery. This means that when zinit pulls down itself and any plugins, their fetch remotes are "root" rather than "origin". This rubs against a hardcoded assumption in the self-update logic that the fetch remote is always "origin", and it simply fails to run, immediately erroring.

Steps to reproduce

  1. Start without zinit installed
  2. git config --global clone.defaultRemoteName root
  3. Install zinit
  4. zinit self-update

Relevant output

[self-update] fetching latest changes from main branch
fatal: ambiguous argument '..origin/HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
[self-update] compiling zinit via zcompile
[self-update] reloading zinit for the current session

Screenshots and recordings

No response

Operating System & Version

OS: linux-gnu | Vendor: redhat | Machine: x86_64 | CPU: x86_64 | Processor: x86_64 | Hardware: x86_64

Zsh version

zsh 5.9 (x86_64-redhat-linux-gnu)

Terminal emulator

kitty, xterm-kitty

If using WSL on Windows, which version of WSL

None

Additional context

No response

Code of Conduct