diff options
| -rw-r--r-- | tests/common/mod.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 1399179..d1c07a4 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -426,7 +426,14 @@ fn copy_tree(from: &Path, to: &Path) { for entry in std::fs::read_dir(from).unwrap() { let entry = entry.unwrap(); let path = entry.path(); - let target = to.join(entry.file_name()); + let name = entry.file_name(); + // A git lock is a claim, not content: it can appear in the listing and + // vanish before the copy, and a copied `index.lock` would make the copy + // refuse to run at all. + if name.to_string_lossy().ends_with(".lock") { + continue; + } + let target = to.join(name); if entry.file_type().unwrap().is_dir() { copy_tree(&path, &target); } else { @@ -548,6 +555,10 @@ pub fn git(dir: &Path, args: &[&str]) -> String { let out = std::process::Command::new("git") .arg("-C") .arg(dir) + // No test is about git's own housekeeping, and a detached maintenance run + // outlives the command that spawned it: it can repack or lock a repo + // while another test is still copying it. + .args(["-c", "maintenance.auto=false", "-c", "gc.auto=0"]) .args(args) .env("GIT_AUTHOR_NAME", "t") .env("GIT_AUTHOR_EMAIL", "t@example.invalid") |
