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

git: Bail out if the url is sparse #167

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MarijnS95
Copy link

I ended up in the accidental case where my URL is sparse, and believe this could also happen if someone uses replace-with in their .cargo/ config.toml. When GitIndex is created, this ends up with a rather useless error:

Refusing to initialize the non-empty directory as '/home/me/.cargo/registry/index/my-custom-registry'

Because it is probably not finding a git repository at that place, without realizing that it's a sparse index cache.

To solve the replace-with case above, or make this crate more generally usable, shouldn't there be (if there isn't already) a high-level wrapper that automatically delegates to SparseIndex if the URL starts with sparse+, and hide the GitIndex/SparseIndex "internals"?

I ended up in the accidental case where my URL is sparse, and believe
this could also happen if someone uses `replace-with` in their `.cargo/
config.toml`.  When `GitIndex` is created, this ends up with a rather
useless error:

    Refusing to initialize the non-empty directory as '/home/me/.cargo/registry/index/my-custom-registry'

Because it is probably not finding a `git` repository at that place,
without realizing that it's a sparse index cache.

To solve the `replace-with` case above, or make this crate more
generally usable, shouldn't there be (if there isn't already) a
high-level wrapper that automatically delegates to `SparseIndex` if
the URL starts with `sparse+`, and hide the `GitIndex`/`SparseIndex`
"internals"?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant