Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add a comment regarding the length of the commit hash
  • Loading branch information
koute committed May 12, 2022
commit e194a067815810fa93a1420eaf088d7a7ebab7cc
3 changes: 3 additions & 0 deletions utils/build-script-utils/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ pub fn generate_cargo_keys() {
let commit = if let Ok(hash) = std::env::var("SUBSTRATE_CLI_GIT_COMMIT_HASH") {
Cow::from(hash.trim().to_owned())
} else {
// We deliberately set the length here to `11` to ensure that
// the emitted hash is always of the same length; otherwise
// it can (and will!) vary between different build environments.
match Command::new("git").args(&["rev-parse", "--short=11", "HEAD"]).output() {
Ok(o) if o.status.success() => {
let sha = String::from_utf8_lossy(&o.stdout).trim().to_owned();
Expand Down