Display current branch and version on the footer #10

Merged
blek merged 6 commits from display-version into 0.2-dev 2023-10-29 10:48:35 +01:00
2 changed files with 8 additions and 3 deletions
Showing only changes of commit 8d5d739568 - Show all commits

View File

@ -69,6 +69,8 @@ fn main() {
});
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_BRANCH={branch}");
}

View File

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