pksunkara / cargo-workspaces

A tool for managing cargo workspaces and their crates, inspired by lerna
MIT License
476 stars 46 forks source link

cannot publish with sparse registries #146

Closed j-baker closed 10 months ago

j-baker commented 10 months ago

When I try to publish with sparse registries, I get:

error: crates index error: Protocol Ext("sparse+https") of url "sparse+https://$MY_REGISTRY" is denied per configuration

If I github code search for this, I find this error has come from gitoxide, https://github.com/search?q=%22is+denied+per+configuration%22&type=code, which is the library Cargo uses to talk to git repositories.

This makes me believe that cargo-workspace-publish is trying to publish using a non-sparse URL.

Looking at https://github.com/pksunkara/cargo-workspaces/blob/master/cargo-workspaces/src/publish.rs#L112, it looks like registry+ is prepended to every url, meaning that with my sparse registry, the url being passed to the is_published check happening in the publish is registry+sparse+https://$MY_REGISTRY which is invalid and so passed through as a git check.

I think that blanket prepending registry+ is an incorrect algorithm. My suspicion is that this check should be skipped as for larger registries it would tend to take an unnecessarily large amount of time.

pksunkara commented 10 months ago

I am using tame_index which I am not familiar with. @Jake-Shadle would you be able to help me understand what I am doing wrong here?

This is also possibly related to #79

Jake-Shadle commented 10 months ago

The issue is correct, prepending registry+ to the URL will cause the URL to be misidentified as a git registry url.

pksunkara commented 10 months ago

@j-baker I have committed the fix to master. Can you please check and confirm so that I can make a release?

j-baker commented 10 months ago

I can confirm that this fixes one part of my issue, and that https://github.com/pksunkara/cargo-workspaces/pull/148 fixes the other parts.

j-baker commented 9 months ago

@pksunkara any chance you could release?

pksunkara commented 9 months ago

I was waiting for your input on https://github.com/pksunkara/cargo-workspaces/pull/148#issuecomment-1875207574. Will do so now.