From cd4818c98491eba0ea8f84386b6c15733f4cf28b Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Tue, 19 Jan 2021 10:19:06 +0100 Subject: [PATCH] fix: full commit hash in canary compile download --- cli/build.rs | 2 +- cli/tools/upgrade.rs | 4 +--- cli/version.rs | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/cli/build.rs b/cli/build.rs index 4d629502454956..b2303571715210 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -221,7 +221,7 @@ fn git_commit_hash() -> String { .output() { if output.status.success() { - std::str::from_utf8(&output.stdout[..7]) + std::str::from_utf8(&output.stdout[..40]) .unwrap() .to_string() } else { diff --git a/cli/tools/upgrade.rs b/cli/tools/upgrade.rs index ab49c06e9d0087..e00127fa472465 100644 --- a/cli/tools/upgrade.rs +++ b/cli/tools/upgrade.rs @@ -40,9 +40,7 @@ pub async fn upgrade_command( let install_version = match version { Some(passed_version) => { let current_is_passed = if canary { - let mut passed_hash = passed_version.clone(); - passed_hash.truncate(7); - crate::version::GIT_COMMIT_HASH == passed_hash + crate::version::GIT_COMMIT_HASH == passed_version } else if !crate::version::is_canary() { crate::version::deno() == passed_version } else { diff --git a/cli/version.rs b/cli/version.rs index ae2b961f247634..6fe7da070408ab 100644 --- a/cli/version.rs +++ b/cli/version.rs @@ -6,7 +6,7 @@ pub const TYPESCRIPT: &str = env!("TS_VERSION"); pub fn deno() -> String { let semver = env!("CARGO_PKG_VERSION"); option_env!("DENO_CANARY").map_or(semver.to_string(), |_| { - format!("{}+{}", semver, GIT_COMMIT_HASH) + format!("{}+{}", semver, &GIT_COMMIT_HASH[..7]) }) }