-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 dependency with a path into a sub-folder location #1462
Comments
You can actually do this today! When you depend on a git repository Cargo will crawl the entire repo looking for packages and you can depend on any of them. |
Oh ok, awesome! I thought it failed the first time I tried it, but I'll give it another shot. Thanks. |
Fantastic! This worked like a charm. |
I tried this and it worked, but it gives me the following warning:
I am using the following dependency:
With the following cargo version:
Is it safe to keep this? |
@augustoteixeira you'll want to remove either |
There is a huge git repo, from which I need a single folder (with its own cargo file and src folder). What is the proper way to handle that? |
Unfortunately git has no way to check out only one folder, so there's nothing to do there unfortunately. |
I see. So when I was doing this:
which leads to the warning. Cargo was just doing the same as if I had typed this?
|
Correct! |
Today I face the same issue, I was needing a sub folder inside a git repo. I think this should be implemented |
Isn't crawling the whole git repo dangerous? What happens if two different subfolders contain crates with equal name? Will that be reported? I would certainly favor allowing explicit subfolders with a combination of git = "....." path="....." |
Cargo does this for git repositories as well: rust-lang/cargo#1462 (comment) This will fix #33, #53 -- integration tests pending. It depends on a nixpkgs buildRustCrate feature PR: NixOS/nixpkgs#82155
Cargo does this for git repositories as well: rust-lang/cargo#1462 (comment) This will fix #33, #53 -- integration tests pending. It depends on a nixpkgs buildRustCrate feature PR: NixOS/nixpkgs#82155
Cargo does this for git repositories as well: rust-lang/cargo#1462 (comment) This will fix #33, #53 -- integration tests pending. It depends on a nixpkgs buildRustCrate feature PR: NixOS/nixpkgs#82155
What's the status of this? I'd like to use a git repo subfolder too |
Definitely need this feature. I encountered this today:
|
Not only the issue of name clashes, but there's a performance cost to crawling a huge repo when the client can be told exactly where to look. |
I need it too, thanks google bring me here. |
There's an issue that can occur when there is a submodule inside of a repository, how do you explicitly depend on both the main folder and the sub-module without using Currently for one of my projects I have to do this to get cargo to properly pull the right versions and rust to compile:
Without this second line the compiler complains it can't find the crate, am I missing something?
|
Still an issue especially when the submodules you dont want are hundreds of megabytes. |
this mimics the heuristic cargo uses for finding crates in their git repositories [0]. [0]: rust-lang/cargo#1462
this mimics the heuristic cargo uses for finding crates in their git repositories ([cargo-issue-1462]). [cargo-issue-1462]: rust-lang/cargo#1462
this mimics the heuristic cargo uses for finding crates in their git repositories ([cargo-issue-1462]). [cargo-issue-1462]: rust-lang/cargo#1462
Yes, you are mistaken. If it is not working, please open a new issue with a minimal repoducabe example. |
Sorry... I resolved my issue and deleted the earlier post. |
Hello, I am trying to load a subfolder in git as a dependency by doing this
But I get the following error! @jnicholls Can you help me please? error: failed to load manifest for workspace member `/Users/tilakmadichetti/Documents/OpenSource/realaderyn/aderyn`
Caused by:
failed to load manifest for dependency `aderyn_driver`
Caused by:
failed to parse manifest at `/Users/tilakmadichetti/Documents/OpenSource/realaderyn/aderyn_driver/Cargo.toml`
Caused by:
dependency (config) specification is ambiguous. Only one of `git` or `path` is allowed.
|
I came across an instance where the repo-searching behavior seems broken and I'm not sure how to resolve it correctly. Namely, https://github.com/cloudflare/workers-rs contains multiple crates, as well as a Because the templates have [patch.crates-io]
worker = { git = "https://github.com/cloudflare/workers-rs.git", branch = "main" }
|
@HALtheWise see #13724 for relevant discussions. |
For
dependencies
we can havegit = <url>
orpath = <path>
but we cannot combine the two, in the cases where a cargo package lives somewhere nested inside of a git repo, i.e. not in the root of the repo. It would be very powerful to be able to provide a relative path into a git repo.Use case: A repo that is a client library containing bindings in more than one language, and the Rust binding is under the
rust
folder inside that repo.The workaround today is to submodule the repo into your own repo, and use a relative
path
config. This levies the requirement of using git of course.The text was updated successfully, but these errors were encountered: