diff --git a/helix-term/build.rs b/helix-term/build.rs new file mode 100644 index 000000000000..f3b341669358 --- /dev/null +++ b/helix-term/build.rs @@ -0,0 +1,13 @@ +use std::process::Command; + +fn main() { + let output = Command::new("git") + .args(&["rev-parse", "HEAD"]) + .output() + .unwrap(); + let git_hash = String::from_utf8(output.stdout).unwrap(); + println!( + "cargo:rustc-env=VERSION_WITH_GIT_HASH={}", + format!("{} ({})", env!("CARGO_PKG_VERSION"), &git_hash[..8]) + ); +} diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs index e178b339df7e..1b17805a4e12 100644 --- a/helix-term/src/main.rs +++ b/helix-term/src/main.rs @@ -81,7 +81,7 @@ FLAGS: } if args.display_version { - println!("helix {}", env!("CARGO_PKG_VERSION")); + println!("helix {}", env!("VERSION_WITH_GIT_HASH")); std::process::exit(0); }