Checkout hash from SourceId

⚓ rust    📅 2025-06-08    👤 surdeus    👁️ 4      

surdeus

Info

This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Checkout hash from SourceId

How 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

Read full topic

🏷️ rust_feed