From 9f6536ce6f51f05091995c3ec7c4a308e8148c8d Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 5 Aug 2024 08:17:18 -0700 Subject: [PATCH] Use a deterministic number of digits in rustc_tools_util commit hashes --- rustc_tools_util/src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rustc_tools_util/src/lib.rs b/rustc_tools_util/src/lib.rs index f8b8084ca1a4c..95e0157608896 100644 --- a/rustc_tools_util/src/lib.rs +++ b/rustc_tools_util/src/lib.rs @@ -104,10 +104,11 @@ impl std::fmt::Debug for VersionInfo { #[must_use] pub fn get_commit_hash() -> Option { let output = std::process::Command::new("git") - .args(["rev-parse", "--short", "HEAD"]) + .args(["rev-parse", "HEAD"]) .output() .ok()?; - let stdout = output.status.success().then_some(output.stdout)?; + let mut stdout = output.status.success().then_some(output.stdout)?; + stdout.truncate(10); String::from_utf8(stdout).ok() }