Open saruman9 opened 3 years ago
It looks like the commit 5a10cd2060c19959e2c55ee33421baa358c09c0b does not exist on any branch or tag in the repository https://github.com/redsift/libbpf.git. The way cargo fetches submodules needs to assume that it exists on some branch or tag.
Unfortunately I can't find any APIs in libgit2 that provide a way to fetch a specific commit, so I don't see a direct way this can be supported. One option is to restructure the net.git-fetch-with-cli
option so that it uses git submodule update --init
instead of git fetch
(or pass the direct revision to git fetch
which is supported as of git 2.5 — the server needs to support uploadpack.allowReachableSHA1InWant, which has been around since 2015 (I think), which I think is safe to assume everyone supports nowadays).
This is something i'm currently running into that i'd really like to see resolved. At the current moment this is making it so that a submodule of one of my dependencies must be on the main/master branch, and that's not exactly doable
Problem
Cargo can't clone/update a git submodule of dependency, for example
redbpf
crate, which contains submodulelibbpf
.Steps
cargo new cargo_issue_git_submodule
cd cargo_issue_git_submodule
echo 'redbpf = { git = "https://github.com/foniod/redbpf" }' >> Cargo.toml
cargo check
And we will get an error:
Possible Solution(s)
Update submodule manually in
~/.cargo/git/checkouts/redbpf-HASH/b81f069/bpf-sys/libbpf
.Notes
cargo version
: cargo 1.55.0commit of
cargo
: 4c27c96645e235d81f6c8dfff03ff9ebaf0ef71d