shared: ignore dirty, if git is present we're developing

When developing dirty can get out of between client and server if you're
only doing development in one.
This commit is contained in:
Bill Thiede 2024-09-01 15:57:02 -07:00
parent 487d7084c3
commit 215b8cd41d

View File

@ -1,5 +1,5 @@
use build_info::{BuildInfo, VersionControl};
use notmuch::SearchSummary;
use build_info::{VersionControl,BuildInfo};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug)]
@ -34,16 +34,12 @@ pub mod urls {
}
}
}
pub fn build_version(bi:fn()->&'static BuildInfo) -> String {
pub fn build_version(bi: fn() -> &'static BuildInfo) -> String {
fn commit(git: &Option<VersionControl>) -> String {
let Some(VersionControl::Git(git)) = git else {
return String::new();
};
let mut s = vec!["-".to_string(), git.commit_short_id.clone()];
if git.dirty {
s.push(".+".to_string());
}
if let Some(branch) = &git.branch {
s.push(format!(" ({branch})"));
}