From b27d5e1ed5ffa6d7a963e29bf8ffdc3f910fcb3e Mon Sep 17 00:00:00 2001 From: Cole Helbling Date: Tue, 31 Mar 2020 14:24:50 -0700 Subject: [PATCH] fixup! fixup! squash! fixup! Show commit hash in version when built from source --- CHANGELOG.md | 2 +- build.rs | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e5e26f..5cf95e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- Commit hash to version output. +- Version output displays `git` revision information. ## [0.3.0] - 2020-03-30 diff --git a/build.rs b/build.rs index f3f7800..b9ae403 100644 --- a/build.rs +++ b/build.rs @@ -5,13 +5,10 @@ fn main() { .ok() .and_then(|proc| String::from_utf8(proc.stdout).ok()); - let mut version_info = format!("v{}-unknown", env!("CARGO_PKG_VERSION")); - - if let Some(description) = git_describe { - if !description.is_empty() { - version_info = description; - } - } + let version_info = match git_describe { + Some(description) if !description.is_empty() => description, + _ => format!("v{}-unknown", env!("CARGO_PKG_VERSION")), + }; println!("cargo:rustc-env=ZOXIDE_VERSION={}", version_info); }