Open obi1kenobi opened 1 year ago
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.
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 shouldcargo-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 aCrate
struct for a given crate name without needing to check cargo index information before deciding betweenIndex
andSparseIndex
. 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 ofIndex
andSparseIndex
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 genericError::Io
orError::Git
).Thanks again for looking into this!