1

I have included a crate as dependency in my Cargo.toml as:

bellman_ce = "=0.3.3"

How do I find which commit id this version of the package points to? Unfortunately, github repo is not tagged by version number.

Shravan
  • 2,553
  • 2
  • 16
  • 19
  • I can look at history of [Cargo.toml](https://github.com/matter-labs/bellman/commits/master/Cargo.toml), but not sure this is the appropriate way to find the commit id. – Shravan Mar 25 '21 at 00:05

3 Answers3

0

You can't. Crates on crates.io don't need to be built from a Git repo, and there is no built-in way to determine what commit a crate was built from. Most crates tag commits in their history where versions came from, but in this case looking at the Git history of Cargo.toml is your only option.

smitop
  • 4,770
  • 2
  • 20
  • 53
0

I'm struggling with the same problem my self. I cannot find a way to get the exact commit id. However, it looks like you can go to the crates.io versions page (e.g., https://crates.io/crates/flexi_logger/versions) and there it will show when each version was published. You might be able to find the commit that corresponds to the version by searching the git history and try to find a commit around the time when the version was published.

skrueger
  • 146
  • 1
  • 6
0

I think what you're looking for is in the .cargo_vcs_info.json file from the crate. It's created as part of cargo package and is documented here: https://doc.rust-lang.org/cargo/commands/cargo-package.html#cargo_vcs_infojson-format. If you can find the source for the crate in question in your $HOME/.cargo/registry/src it should be there.

flihp
  • 101
  • 1