mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-30 16:39:26 +00:00
Use a deterministic number of digits in rustc_tools_util commit hashes
This commit is contained in:
parent
c082bc2cb8
commit
9f6536ce6f
1 changed files with 3 additions and 2 deletions
|
@ -104,10 +104,11 @@ impl std::fmt::Debug for VersionInfo {
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn get_commit_hash() -> Option<String> {
|
pub fn get_commit_hash() -> Option<String> {
|
||||||
let output = std::process::Command::new("git")
|
let output = std::process::Command::new("git")
|
||||||
.args(["rev-parse", "--short", "HEAD"])
|
.args(["rev-parse", "HEAD"])
|
||||||
.output()
|
.output()
|
||||||
.ok()?;
|
.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()
|
String::from_utf8(stdout).ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue