fix: full commit hash in canary compile download (#9166)

This commit is contained in:
Luca Casonato 2021-01-19 13:53:23 +01:00 committed by GitHub
parent 867ce78fb6
commit cf3202644d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 5 deletions

View File

@ -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 {

View File

@ -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 {

View File

@ -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])
})
}