| 227 | |
| 228 | #[cfg(unix)] |
| 229 | fn git(root: &Path, args: &[&str], tick: Option<usize>) -> Result<()> { |
| 230 | let output = Command::new("git") |
| 231 | .args(args) |
| 232 | .current_dir(root) |
| 233 | .env("GIT_AUTHOR_NAME", "bench") |
| 234 | .env("GIT_AUTHOR_EMAIL", "bench@example.invalid") |
| 235 | .env("GIT_COMMITTER_NAME", "bench") |
| 236 | .env("GIT_COMMITTER_EMAIL", "bench@example.invalid") |
| 237 | .env( |
| 238 | "GIT_AUTHOR_DATE", |
| 239 | format!("{} +0000", 1_600_000_000 + tick.unwrap_or(0)), |
| 240 | ) |
| 241 | .env( |
| 242 | "GIT_COMMITTER_DATE", |
| 243 | format!("{} +0000", 1_600_000_000 + tick.unwrap_or(0)), |
| 244 | ) |
| 245 | .output() |
| 246 | .with_context(|| format!("running git {}", args.join(" ")))?; |
| 247 | ensure!( |
| 248 | output.status.success(), |
| 249 | "git {} failed: {}", |
| 250 | args.join(" "), |
| 251 | String::from_utf8_lossy(&output.stderr) |
| 252 | ); |
| 253 | Ok(()) |
| 254 | } |
| 255 | |
| 256 | /// Build the atomic host repository and the Git bare repository with the |
| 257 | /// same synthetic content. Returns the atomic golden and the bare path. |