summaryrefslogtreecommitdiffstats
path: root/tests/common
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-20 06:47:51 +0000
committeraur-build <aur-build@localhost>2026-11-20 06:47:51 +0000
commit1aa7c13a4ae02bf47f5b76482e83c129bf6a438e (patch)
treefb6e948aab97f06493ed2092e43f8006374c40f3 /tests/common
parent7e3369e92d154c8ed532b977d5dd541398b5197d (diff)
downloadaur-build-1aa7c13a4ae02bf47f5b76482e83c129bf6a438e.tar.gz
aur-build-1aa7c13a4ae02bf47f5b76482e83c129bf6a438e.zip
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.
Diffstat (limited to 'tests/common')
-rw-r--r--tests/common/mod.rs13
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")