From 1aa7c13a4ae02bf47f5b76482e83c129bf6a438e Mon Sep 17 00:00:00 2001 From: aur-build Date: Fri, 20 Nov 2026 06:47:51 +0000 Subject: tests: stop copying git's locks, and stop git making them copy_tree walked a live repo and tried to copy .git/objects/maintenance.lock after git's detached maintenance had already removed it - a claim, not content, and a copied index.lock would have made the copy refuse to run anyway. Locks are skipped now, and the test git helper runs with maintenance.auto and gc.auto off, so nothing repacks a repo behind a test that is still copying it. Background maintenance spawns in a sampled pair of binaries went 72 to 21; the rest come from the library's own clone and fetch, in directories nobody copies from. Five consecutive full-suite runs clean, against roughly two in three failing before. --- tests/common/mod.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tests/common/mod.rs') 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") -- cgit v1.2.3