mirror of
https://github.com/freedit-org/freedit.git
synced 2026-01-06 19:24:03 -05:00
14 lines
385 B
Rust
14 lines
385 B
Rust
use std::process::Command;
|
|
|
|
fn main() {
|
|
let mut git_commit = match Command::new("git").args(["rev-parse", "HEAD"]).output() {
|
|
Ok(output) if !output.stdout.is_empty() => {
|
|
String::from_utf8_lossy(&output.stdout).to_string()
|
|
}
|
|
_ => "not found".into(),
|
|
};
|
|
|
|
git_commit.truncate(7);
|
|
println!("cargo:rustc-env=GIT_COMMIT={git_commit}");
|
|
}
|