Fix the version command to include the commit hash (#2390)

* Fix the version command to include the commit hash when it is _not_ empty

* Format code
This commit is contained in:
Shaurya 2020-08-22 08:51:59 +05:30 committed by GitHub
parent d65a38dd41
commit a951edd0d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,7 +50,7 @@ pub fn version(args: CommandArgs, _registry: &CommandRegistry) -> Result<OutputS
UntaggedValue::string(clap::crate_version!()).into_value(&tag),
);
let commit_hash = Some(GIT_COMMIT_HASH.trim()).filter(|x| x.is_empty());
let commit_hash = Some(GIT_COMMIT_HASH.trim()).filter(|x| !x.is_empty());
if let Some(commit_hash) = commit_hash {
indexmap.insert(
"commit_hash".to_string(),