about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--build.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/build.rs b/build.rs
index 9a8bb77a8ed..8e1ed287159 100644
--- a/build.rs
+++ b/build.rs
@@ -25,7 +25,7 @@ fn main() {
 // (git not installed or if this is not a git repository) just return an empty string.
 fn commit_info() -> String {
     match (channel(), commit_hash(), commit_date()) {
-        (channel, Some(hash), Some(date)) => format!("{} ({} {})", channel, hash.trim_end(), date),
+        (channel, Some(hash), Some(date)) => format!("{} ({} {})", channel, hash, date),
         _ => String::new(),
     }
 }
@@ -39,11 +39,13 @@ fn channel() -> String {
 }
 
 fn commit_hash() -> Option<String> {
-    Command::new("git")
-        .args(["rev-parse", "--short", "HEAD"])
+    let output = Command::new("git")
+        .args(["rev-parse", "HEAD"])
         .output()
-        .ok()
-        .and_then(|r| String::from_utf8(r.stdout).ok())
+        .ok()?;
+    let mut stdout = String::from_utf8(output.stdout).ok()?;
+    stdout.truncate(10);
+    Some(stdout)
 }
 
 fn commit_date() -> Option<String> {