Checkout hash from SourceId
⚓ Rust 📅 2025-06-08 👤 surdeus 👁️ 17How can I get the hash for a SourceId that is used in ~/.cargo/git/checkouts/?
Or in other words:
How can I get the path to the git sources of a dependency defined in a Cargo.lock file?
I tried:
let source_id = SourceId::from_url(source).unwrap();
let hash = cargo::util::hex::short_hash(&source_id);
But this is different from what I found in the filesystem.
4 posts - 2 participants
🏷️ rust_feed