include branch data

This commit is contained in:
blek 2023-10-29 19:14:58 +10:00
parent b9f0d80dc3
commit 8d5d739568
Signed by: blek
GPG Key ID: 14546221E3595D0C
2 changed files with 8 additions and 3 deletions

View File

@ -69,6 +69,8 @@ fn main() {
}); });
let commit = system("git", &["rev-parse", "HEAD"]); let commit = system("git", &["rev-parse", "HEAD"]);
let branch = system("git", &["rev-parse", "--abbrev-rev", "HEAD"]);
println!("cargo:rustc-env=COMMIT_HASH={commit}"); println!("cargo:rustc-env=COMMIT_HASH={commit}");
println!("cargo:rustc-env=COMMIT_BRANCH={branch}");
} }

View File

@ -17,12 +17,15 @@ pub struct Redis {
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct VersionData { pub struct VersionData {
pub commit: String pub commit: String,
pub branch: String
} }
impl Default for VersionData { impl Default for VersionData {
fn default() -> Self { fn default() -> Self {
VersionData { VersionData {
commit: env!("COMMIT_HASH").to_string() commit: env!("COMMIT_HASH").to_string(),
branch: env!("COMMIT_BRANCH").to_string()
} }
} }
} }