INNER CODE UNIT · Rust
date
pingw33n/vault13 · build.rs:15
fn date(&self) -> &str {
&self.timestamp[..10]
}
}
fn last_git_commit() -> LastGitCommit {
let output = Command::new("git")
.args(["log", "-1", "--format=%H %cd", "--date=format-local:%Y-%m-%dT%H:%M:%SZ"])
.env("TZ", "UTC")
.output().unwrap();
let parts: Vec<_> = std::str::from_utf8(&output.stdout).unwrap().trim()
.split(' ')
.collect();
assert_eq!(parts.len(), 2, "{:?}", parts);
LastGitCommit {
hash: parts[0].into(),
timestamp: parts[1].into(),
}