From 050dfb6940bdad9e3bf8c3653e0f1361c4ef79d1 Mon Sep 17 00:00:00 2001 From: Daniel Rispler Date: Sat, 28 Nov 2026 19:03:44 +0200 Subject: [PATCH 1/2] Studio tests: test-support's git turns off auto-maintenance, one process fewer per commit (#823) studio_test_support::git passes -c maintenance.auto=false -c gc.auto=0, as the hook's git does (#141), so a commit through it no longer starts a detached `git maintenance run --auto`. A test in test-support checks a commit's GIT_TRACE for it. Co-Authored-By: Claude Opus 5.5 --- test-support/src/lib.rs | 7 ++++++- test-support/tests/git.rs | 25 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 test-support/tests/git.rs diff --git a/test-support/src/lib.rs b/test-support/src/lib.rs index ed2f7dc0..0b9920a6 100644 --- a/test-support/src/lib.rs +++ b/test-support/src/lib.rs @@ -14,7 +14,8 @@ use std::{ }; /// Runs `git` in `dir` as the studio's own identity, away from the developer's git config, and -/// returns its output without the trailing newline. +/// returns its output without the trailing newline. It never starts auto maintenance, which every +/// commit would otherwise start in the background (#823), as the hook's `git` doesn't (#141). pub fn git(dir: &Path, args: &[&str]) -> String { let output = Command::new("git") .args([ @@ -22,6 +23,10 @@ pub fn git(dir: &Path, args: &[&str]) -> String { "user.name=Studio", "-c", "user.email=studio@example.com", + "-c", + "maintenance.auto=false", + "-c", + "gc.auto=0", ]) .args(args) .current_dir(dir) diff --git a/test-support/tests/git.rs b/test-support/tests/git.rs new file mode 100644 index 00000000..284665c8 --- /dev/null +++ b/test-support/tests/git.rs @@ -0,0 +1,25 @@ +//! The tests' `git`: what it starts besides the command it was given. + +use std::fs; +use studio_test_support::{git, repo}; + +#[test] +fn a_commit_through_the_tests_git_starts_no_auto_maintenance() { + let (dir, _) = repo(); + let trace = dir.path().join("trace"); + // SAFETY: nextest runs each test in a process of its own, and no thread has started yet; this file's binary + // holds this one test, so under `cargo test` no other test thread reads the environment either. + unsafe { std::env::set_var("GIT_TRACE", &trace) }; + + git( + dir.path(), + &["commit", "-q", "--allow-empty", "-m", "Second"], + ); + + let trace = fs::read_to_string(&trace).unwrap(); + assert!( + trace.contains("commit"), + "the trace caught the commit:\n{trace}" + ); + assert!(!trace.contains("maintenance"), "{trace}"); +} From ca4175841723c56825620a7ea9743b01b20018e5 Mon Sep 17 00:00:00 2001 From: Daniel Rispler Date: Sat, 28 Nov 2026 19:04:54 +0200 Subject: [PATCH 2/2] Studio tests: clearer words in the git helper's doc and the maintenance test's message (#823) Co-Authored-By: Claude Opus 5.5 --- test-support/src/lib.rs | 2 +- test-support/tests/git.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/test-support/src/lib.rs b/test-support/src/lib.rs index 0b9920a6..632e61ea 100644 --- a/test-support/src/lib.rs +++ b/test-support/src/lib.rs @@ -15,7 +15,7 @@ use std::{ /// Runs `git` in `dir` as the studio's own identity, away from the developer's git config, and /// returns its output without the trailing newline. It never starts auto maintenance, which every -/// commit would otherwise start in the background (#823), as the hook's `git` doesn't (#141). +/// commit would otherwise start in the background (#823); the hook's `git` turns it off too (#141). pub fn git(dir: &Path, args: &[&str]) -> String { let output = Command::new("git") .args([ diff --git a/test-support/tests/git.rs b/test-support/tests/git.rs index 284665c8..edb90158 100644 --- a/test-support/tests/git.rs +++ b/test-support/tests/git.rs @@ -21,5 +21,8 @@ fn a_commit_through_the_tests_git_starts_no_auto_maintenance() { trace.contains("commit"), "the trace caught the commit:\n{trace}" ); - assert!(!trace.contains("maintenance"), "{trace}"); + assert!( + !trace.contains("maintenance"), + "the commit started auto maintenance:\n{trace}" + ); }