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

Expose crates_index::git::URL even without git feature #149

Closed
Nemo157 opened this issue Aug 19, 2023 · 3 comments · Fixed by #150
Closed

Expose crates_index::git::URL even without git feature #149

Nemo157 opened this issue Aug 19, 2023 · 3 comments · Fixed by #150

Comments

@Nemo157
Copy link
Contributor

Nemo157 commented Aug 19, 2023

I'm transitioning cargo-dl to use the new sparse feature support, as part of that I want to check the .crate download caches for both the sparse and git index to avoid having to actually download if the user has the package already. I'm using crates_index::local_path_and_canonical_url to handle the bulk of the local path determination for me and then moving from that to the cache directory. At least at the moment I don't plan to support using the git index, but to get the URL to pass to local_path... I still need to activate the feature (or hardcode my own copy of it).

@Byron
Copy link
Collaborator

Byron commented Aug 19, 2023

Maybe URLs can generally move to their own module which is always available.

Further, I recommend having a look at tame-index, which should provide a better experience around sparse indices while not suffering from #133.

@Nemo157
Copy link
Contributor Author

Nemo157 commented Aug 19, 2023

tame-index is actually much less convenient for me, because it returns http::Request instead of http::request::Builder, which ureq doesn't have interop support for, I'd have to manually translate the details. I assume #133 only affects GitIndex so I should be fine with that.

I'm not sure if a module is necessary for the urls, they could be top-level GIT_URL and SPARSE_URL consts, otherwise I guess pub mod urls { const GIT; const SPARSE; } is what you're imagining? I could prepare a PR for whatever you think best.

@Byron
Copy link
Collaborator

Byron commented Aug 19, 2023

Maybe none of these is great after all 😅. What about keeping the existing structure and refactor so that git::URL is always available? Then it matches with sparse::URL which is always there as well.
And yes, a PR would be appreciated, thanks for offering.

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

Successfully merging a pull request may close this issue.

2 participants