commit 9cfae313aa1c2c16a7b4d69150f3804f08d7cfd0
parent c9d1b487064f00bfcda9d3f6ce4115f31d365fec
Author: William Casarin <jb55@jb55.com>
Date: Fri, 22 Nov 2024 13:03:11 -0800
Merge include commit hash in SupportView #471
kernelkind (1):
include commit hash in SupportView
Diffstat:
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/build.rs b/build.rs
@@ -0,0 +1,10 @@
+use std::process::Command;
+
+fn main() {
+ if let Ok(output) = Command::new("git").args(["rev-parse", "HEAD"]).output() {
+ if output.status.success() {
+ let hash = String::from_utf8_lossy(&output.stdout);
+ println!("cargo:rustc-env=GIT_COMMIT_HASH={}", hash.trim());
+ }
+ }
+}
diff --git a/src/support.rs b/src/support.rs
@@ -29,7 +29,7 @@ impl Support {
static MAX_LOG_LINES: usize = 500;
static SUPPORT_EMAIL: &str = "support@damus.io";
-static EMAIL_TEMPLATE: &str = "Describe the bug you have encountered:\n<-- your statement here -->\n\n===== Paste your log below =====\n\n";
+static EMAIL_TEMPLATE: &str = concat!("Commit hash: ", env!("GIT_COMMIT_HASH"), "\n\nDescribe the bug you have encountered:\n<-- your statement here -->\n\n===== Paste your log below =====\n\n");
impl Support {
pub fn refresh(&mut self) {
diff --git a/src/ui/support.rs b/src/ui/support.rs
@@ -75,6 +75,7 @@ impl<'a> SupportView<'a> {
.color(egui::Color32::RED),
);
}
+ ui.label(format!("Commit hash: {}", env!("GIT_COMMIT_HASH")));
});
}
}