| 64 | } |
| 65 | |
| 66 | fn git(root: &Path, args: &[&str]) -> String { |
| 67 | let output = Command::new("git") |
| 68 | .args(args) |
| 69 | .current_dir(root) |
| 70 | .env("GIT_AUTHOR_NAME", "Sibling Eviction Tests") |
| 71 | .env("GIT_AUTHOR_EMAIL", "sibling-eviction@example.com") |
| 72 | .env("GIT_COMMITTER_NAME", "Sibling Eviction Tests") |
| 73 | .env("GIT_COMMITTER_EMAIL", "sibling-eviction@example.com") |
| 74 | .output() |
| 75 | .expect("run git"); |
| 76 | assert!( |
| 77 | output.status.success(), |
| 78 | "git {args:?} failed: {}", |
| 79 | String::from_utf8_lossy(&output.stderr) |
| 80 | ); |
| 81 | String::from_utf8(output.stdout) |
| 82 | .expect("utf8 git output") |
| 83 | .trim() |
| 84 | .to_string() |
| 85 | } |
| 86 | |
| 87 | fn commit_at(root: &Path, date: &str, message: &str) -> String { |
| 88 | git(root, &["add", "."]); |