From 4cc44f8cc7a253d3f1ac082a05a4c55ea520c798 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Fri, 25 Feb 2022 17:33:32 +0000 Subject: [PATCH] performance-metrics: Trim whitespace from git command output This removes trailing "\n"s from the strings saved in the JSON file. Signed-off-by: Rob Bradford --- performance-metrics/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/performance-metrics/src/main.rs b/performance-metrics/src/main.rs index 756b5ed7e..7847decbc 100644 --- a/performance-metrics/src/main.rs +++ b/performance-metrics/src/main.rs @@ -52,7 +52,7 @@ impl Default for MetricsReport { if let Ok(git_out) = Command::new("git").args(&["describe", "--dirty"]).output() { if git_out.status.success() { if let Ok(git_out_str) = String::from_utf8(git_out.stdout) { - git_human_readable = git_out_str; + git_human_readable = git_out_str.trim().to_string(); } } } @@ -61,7 +61,7 @@ impl Default for MetricsReport { if let Ok(git_out) = Command::new("git").args(&["rev-parse", "HEAD"]).output() { if git_out.status.success() { if let Ok(git_out_str) = String::from_utf8(git_out.stdout) { - git_revision = git_out_str; + git_revision = git_out_str.trim().to_string(); } } } @@ -73,7 +73,7 @@ impl Default for MetricsReport { { if git_out.status.success() { if let Ok(git_out_str) = String::from_utf8(git_out.stdout) { - git_committer_date = git_out_str; + git_committer_date = git_out_str.trim().to_string(); } } }