zdharma-continuum / zinit

🌻 Flexible and fast ZSH plugin manager
MIT License
2.77k stars 123 forks source link

Can't install OMZ plugin that has multiple files (Subversion not found) #481

Closed GaryBoone closed 1 year ago

GaryBoone commented 1 year ago

What happened?

I'm unable to figure out how to load an OMZ plugin that has more than one file. In particular, aliases is implemented in Python, so cheatsheet.py from the same directory must also be downloaded.

From the wiki, "Snippets are single files..." and "Moreover, snippets support Subversion protocol, supported also by Github. This allows to load snippets that are multi-file..." Here is the example given there:

# URL points to directory
zinit ice svn
zinit snippet PZT::modules/docker

Steps to reproduce

However, when I add to my .zshrc:

# URL points to directory
zinit ice svn
zinit snippet OMZP::aliases

Relevant output

The error is:

Setting up snippet: OMZP::aliases
Downloading `OMZP::aliases` (with Subversion)…
Warning: Subversion not found , please install it to use `svn' ice.
.zinit-mirror-using-svn:27: command not found: svn


### Screenshots and recordings

_No response_

### Operating System & Version

OS: darwin22.1.0 | Vendor: apple | Machine: x86_64 | CPU: x86_64 | Processor: i386 | Hardware: x86_64

### Zsh version

zsh 5.9 (x86_64-apple-darwin22.1.0)

### Terminal emulator

xterm-256color

### If using WSL on Windows, which version of WSL

None

### Additional context

Additional question: What should be the incantation to turboload `OMZP::aliases`?

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct
dnanhkhoa commented 1 year ago

It looks like svn hasn't been installed yet. If you are using macOS, you can install svn using homebrew. Using brew install svn to install it first.

GaryBoone commented 1 year ago

While that makes sense, none of the zinit documentation that I've found has said that svn needs to be installed. Seems strange to need another protocol other than Git to download from Github. My reading was that zinit used the svn protocol, which GitHub supports, not that svn was required.

I just noticed this comment on the wiki under Cloning Options/svn: "Does not work with plugins." So maybe this is a known issue.

Maybe this bug should be changed to be "Support multiple file downloads with Git".

vladdoster commented 1 year ago

@GaryBoone @dnanhkhoa,

While that makes sense, none of the zinit documentation I've found has said that svn needs to be installed.

I agree the documentation needs some updating and elaboration of certain features.

Warning: Subversion not found, please install it to use `svn' ice.

However, I will point out that the error message states you need to install Subversion.

Seems strange to need another protocol other than Git to download from Github. My reading was that zinit used the svn protocol, which GitHub supports, not that svn was required.

You're technically correct Git supports SVN, but it isn't quite that cut and dry.

The git-svn subcommand is implemented as a perl script, see here. The script expects that the package SVN::Core is installed otherwise exits. And on the SVN::Core CPAN (perl package manager) page has the following message:

If you are looking for SVN::Core, it gets built with the Subversion binaries on your system, and is not available on CPAN. You need to specify at configure time if it should be built and installed. If your OS app packaging didn't do that for you then check

So to to run git-svn you need Subversion installed.


Maybe this bug should be changed to be "Support multiple file downloads with Git".

This is the exact reason Subversion was used. Subversion allows for easily cloning directory/file within a repository. At the time Zinit was created, it was not possible with git. However, it is now supported, but it is a messy process.

# Create a directory, so Git doesn't get messy, and enter it
mkdir my-dir && cd my-dir

# Start a Git repository
git init

# Track repository, do not enter subdirectory
git remote add -f origin https://github.com/ohmyzsh/ohmyzsh/

# Enable the tree check feature
git config core.sparseCheckout true

# Create a file in the path: .git/info/sparse-checkout
# That is inside the hidden .git directory that was created
# by running the command: git init
# And inside it enter the name of the sub directory you only want to clone
echo 'files' >> .git/info/sparse-checkout

## Download with pull, not clone
git pull origin main
svn export https://github.com/ohmyzsh/ohmyzsh/trunk/<directory>

We will be forced to update to using git at some point due to sunsetting SVN support. This has been brought up in #465.

GaryBoone commented 1 year ago

Thanks for clearly documenting the issue here. Summarizing, it sounds like the resolutions are to either: 1) incorporate the messy Git process into zinit 2) wait for direct Git support and clarify the documentation with a note that SVN is required until then.

vladdoster commented 1 year ago

@GaryBoone,

Closing issue in favor of #504 for tracking progress on removing the Subversion dependency.