zdharma-continuum / zinit

🌻 Flexible and fast ZSH plugin manager
MIT License
3k stars 127 forks source link

[feat]: remove `subversion` dependency #504

Open vladdoster opened 1 year ago

vladdoster commented 1 year ago

Issue

Github is sunsetting Subversion support in 2024.

Proposed feature

git sparse-checkout

To restrict working directory to a set of directories, run the following commands:

git sparse-checkout init --cone git sparse-checkout set ...

Caveats

The sparse-checkout feature was introduced in Git v2.25 (2020), so it could break on older distributions.

For example, all versions older than Ubuntu 19.0.4 do not ship with a compatible Git version.

Published version of Git located here

Related Issues

481

MenkeTechnologies commented 8 months ago

I want to load the OMZ plugin macos but it sources 2 script files in the OMZ plugin directory, spotify and music.

~/.zinit/snippets/OMZP::macos/OMZP::macos:source:269: no such file or directory: 
~/.zinit/snippets/OMZP::macos/music
~/.zinit/snippets/OMZP::macos/OMZP::macos:source:272: no such file or directory: 
~/.zinit/snippets/OMZP::macos/spotify

Now that svn support is gone from GitHub, how do I load that snippet?

I tried to clone the individual scripts like

zinit snippet OMZP::macos/music but I get:

==> Downloading OMZP::macos/music (with curl, wget, lftp)
curl: (22) The requested URL returned error: 404
curl: (22) The requested URL returned error: 404
ERROR: Download failed.

Using sparse-checkout would work as mentioned.

git clone -n --depth=1 --filter=tree:0 https://github.com/ohmyzsh/ohmyzsh
cd ohmyzsh
git sparse-checkout set --no-cone plugins/macos
git checkout
Magotchi commented 8 months ago

As of 2024-01-08, GitHub has removed support for the Subversion protocol entirely. I noticed this when "svn OMZP::gitfast" stopped working for me in zinit. This issue is now more of a bug than a feature request.

Apparently this was noticed already in another closed issue, but that seems to have only addressed the zinit "snippet" feature.

atanaspam commented 7 months ago

I created a temporary workaround for getting the macos plugin working with zinit can be achieved by using gists or a one-off local copy of the macos plugin. For example I created the following gist https://gist.github.com/atanaspam/b43be6c483893bfe411764f3c6902ff7 which essentially contains a glued copy of the contents of the macos.plugin.zsh, music and spotify files into a single file. After that one can just load the gist as normal.

zinit snippet https://gist.githubusercontent.com/atanaspam/b43be6c483893bfe411764f3c6902ff7/raw/

The same logic can be applied for any other dependency that previously required ice svn as long as the number of files is managable.

fengkx commented 7 months ago

I am using shell-proxy omz plugin. It contains python scripts. So copy pasting into one files is not woking for this. I can't found any workaround for now...

ICHx commented 6 months ago

+1, trying out zinit today, and this become an issue for new OMZ users, not mentioned in README https://github.com/zdharma-continuum/zinit/issues/465 https://github.com/zdharma-continuum/zinit/issues/481

shaneog commented 5 months ago

Is there a documented workaround for this at the moment?

fleXible commented 4 months ago

Has anybody found a no-code-change and scalable work-around?

Snippets with more than a single file, that used to be cloned with svn, to me are broken for me right now.

This involves multiple oh-my-zsh and prezto modules (git, helper, node, python, utility, ...)

repkid commented 4 months ago

I have created a quick and dirty workaround for the issue with OMZ plugins and posted it here: #651

ngocphamm commented 4 weeks ago

To extend fantastic work of @repkid, here's for Prezto Modules

_fix-pzt-module() {
  if [[ ! -f ._zinit/teleid ]] then return 0; fi
  if [[ ! $(cat ._zinit/teleid) =~ "^PZT::.*" ]] then return 0; fi
  local PZTM_NAME=$(cat ._zinit/teleid | sed -n 's/PZT::modules\///p')
  git clone --quiet --no-checkout --depth=1 --filter=tree:0 https://github.com/sorin-ionescu/prezto
  cd prezto
  git sparse-checkout set --no-cone modules/$PZTM_NAME
  git checkout --quiet
  cd ..
  local file
  for file in prezto/modules/$PZTM_NAME/*~(.gitignore|*.plugin.zsh)(D); do
    local filename="${file:t}"
    echo "Copying $file to $(pwd)/$filename..."
    cp -R $file $filename
  done
  rm -rf prezto
}

Note this is for PZT::modules/name format and NOT PZTM::name, because of the dependencies going on with Prezto modules. For example utility depends on helper and spectrum.

With the old SVN ice, declaring PZT::modules/utility is enough and zinit will fetch helper and spectrum as well.

With this workaround, all 3 have to be declared.