INNER CODE UNIT · Rust

short_hash

pingw33n/vault13 · build.rs:11

    fn short_hash(&self) -> &str {
        &self.hash[..9]
    }

    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);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…