Skip to content

Commit

Permalink
Merge pull request #315 from facebookexperimental/htejun/misc
Browse files Browse the repository at this point in the history
rd-utils: Improve VERGEN_GIT_SHA handling
  • Loading branch information
htejun authored May 2, 2024
2 parents f320519 + f80db3d commit 9da5cab
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions rd-util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,19 @@ pub const MSEC: f64 = 1.0 / 1000.0;
pub const READ: usize = 0;
pub const WRITE: usize = 1;

#[rustfmt::skip]
lazy_static::lazy_static! {
static ref GIT_VERSION: String = {
let mut ver = String::new();
if let Some(v) = option_env!("VERGEN_GIT_SHA") {
ver += "g";
ver += v;
if let Some("true") = option_env!("VERGEN_GIT_DIRTY") {
ver += "-dirty";
match option_env!("VERGEN_GIT_SHA") {
Some(v) if v != "VERGEN_IDEMPOTENT_OUTPUT" => {
ver += "g";
ver += v;
if let Some("true") = option_env!("VERGEN_GIT_DIRTY") {
ver += "-dirty";
}
}
_ => {}
}
ver
};
Expand Down

0 comments on commit 9da5cab

Please sign in to comment.