From 4c00d1846b03fa16cde68e5b858fac7c36c3bad9 Mon Sep 17 00:00:00 2001 From: futile Date: Wed, 5 Nov 2025 00:33:17 +0000 Subject: [PATCH] add git commit hash when hovering version info --- build.rs | 12 ++++++++++++ src/gui/app.rs | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index ecf3529..85bb3db 100644 --- a/build.rs +++ b/build.rs @@ -8,4 +8,16 @@ fn main() { .set_icon("assets/icon.ico") .compile() .unwrap(); + println!( + "cargo:rustc-env=LATEST_GIT_COMMIT_HASH={}", + latest_git_commit_hash() + ) +} + +fn latest_git_commit_hash() -> String { + let git_rev_parse = std::process::Command::new("git") + .args(&["rev-parse", "--short=8", "HEAD"]) + .output() + .unwrap(); + String::from_utf8(git_rev_parse.stdout).unwrap() } diff --git a/src/gui/app.rs b/src/gui/app.rs index f0aacc7..313dfaa 100644 --- a/src/gui/app.rs +++ b/src/gui/app.rs @@ -236,7 +236,8 @@ impl App { if cfg!(debug_assertions) { ui.label("(dev)"); } - ui.label(format!("v{}", env!("CARGO_PKG_VERSION"))); + ui.label(format!("v{}", env!("CARGO_PKG_VERSION"))) + .on_hover_text(env!("LATEST_GIT_COMMIT_HASH")); ui.scope(|ui| { ui.style_mut().spacing.button_padding = egui::Vec2::new(3.0, 0.0); let button = ui