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

Auto-detect index configuration (sparse or not) #128

Open
obi1kenobi opened this issue Jul 11, 2023 · 1 comment
Open

Auto-detect index configuration (sparse or not) #128

obi1kenobi opened this issue Jul 11, 2023 · 1 comment

Comments

@obi1kenobi
Copy link
Contributor

Thanks again for this awesome crate, cargo-semver-checks wouldn't have been possible without it! I have a question that I couldn't figure out the answer to by looking at the docs and some of the source code.

In this cargo-semver-checks issue, a user is using an index mirror that is sparse-only and therefore our usual trick of "ignore the sparse config and use the old protocol anyway" doesn't work. How should cargo-semver-checks load crate info so as to be maximally compatible with users' local configurations?

Ideally, there would be a way for cargo-semver-checks to just load a Crate struct for a given crate name without needing to check cargo index information before deciding between Index and SparseIndex. Is this possible already, or if not, is it feasible to implement?

Barring that, is there a good and reliable way within this crate to figure out whether the configured index is sparse or not? Asking because right now in cargo-semver-checks I don't know which of Index and SparseIndex to attempt to use when. I even don't mind an approach like "try making a sparse index, and if it doesn't work, try again with non-sparse" so long as we can get a predictable error variant to match on that corresponds to this case and this case alone (as opposed to matching on a generic Error::Io or Error::Git).

Thanks again for looking into this!

@ToBinio ToBinio mentioned this issue Jul 29, 2023
10 tasks
@Byron
Copy link
Collaborator

Byron commented Jul 29, 2023

I don't know if it helps, but now there is a new function to obtain the local paths of (possibly non-existing) indices, git or sparse alike.

Until there are better ways which could be brainstormed here or downright contributed, maybe the new addition helps.

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

No branches or pull requests

2 participants