Look up git commit hash ourselves, drop libgit2 dependency (#5548)

This commit is contained in:
Reilly Wood
2022-05-15 21:57:25 -04:00
committed by GitHub
parent 44bcfb3403
commit d90b25c633
4 changed files with 19 additions and 26 deletions

View File

@ -63,21 +63,7 @@ pub fn version(
span: call.head,
});
cols.push("tag".to_string());
vals.push(Value::String {
val: shadow_rs::tag(),
span: call.head,
});
let short_commit: Option<&str> = Some(shadow::SHORT_COMMIT).filter(|x| !x.is_empty());
if let Some(short_commit) = short_commit {
cols.push("short_commit".to_string());
vals.push(Value::String {
val: short_commit.to_string(),
span: call.head,
});
}
let commit_hash: Option<&str> = Some(shadow::COMMIT_HASH).filter(|x| !x.is_empty());
let commit_hash: Option<&str> = option_env!("NU_COMMIT_HASH");
if let Some(commit_hash) = commit_hash {
cols.push("commit_hash".to_string());
vals.push(Value::String {
@ -85,14 +71,6 @@ pub fn version(
span: call.head,
});
}
let commit_date: Option<&str> = Some(shadow::COMMIT_DATE).filter(|x| !x.is_empty());
if let Some(commit_date) = commit_date {
cols.push("commit_date".to_string());
vals.push(Value::String {
val: commit_date.to_string(),
span: call.head,
});
}
let build_os: Option<&str> = Some(shadow::BUILD_OS).filter(|x| !x.is_empty());
if let Some(build_os) = build_os {