diff --git a/crates/forge-web/tests/mirrors_e2e.rs b/crates/forge-web/tests/mirrors_e2e.rs index 0867698..0cda617 100644 --- a/crates/forge-web/tests/mirrors_e2e.rs +++ b/crates/forge-web/tests/mirrors_e2e.rs @@ -138,6 +138,17 @@ fn run_admin(config: &Path, username: &str, extra: &[&str], password: &str) { ); } +/// Fixed identity and config isolation for every git this file spawns, so the result does not +/// depend on the machine's global git config (a clean CI container has none). +const GIT_HERMETIC_ENV: &[(&str, &str)] = &[ + ("GIT_AUTHOR_NAME", "tahinli"), + ("GIT_AUTHOR_EMAIL", "tahinli@example.com"), + ("GIT_COMMITTER_NAME", "tahinli"), + ("GIT_COMMITTER_EMAIL", "tahinli@example.com"), + ("GIT_CONFIG_GLOBAL", "/dev/null"), + ("GIT_CONFIG_NOSYSTEM", "1"), +]; + /// Runs git with credential helpers disabled and extra env. Returns the raw output. fn git_output(cwd: &Path, args: &[&str], env: &[(&str, &str)]) -> Output { let mut cmd = Command::new("git"); @@ -145,7 +156,7 @@ fn git_output(cwd: &Path, args: &[&str], env: &[(&str, &str)]) -> Output { .args(["-c", "credential.helper="]) .args(args) .env("GIT_TERMINAL_PROMPT", "0"); - for (key, value) in env { + for (key, value) in GIT_HERMETIC_ENV.iter().chain(env) { cmd.env(key, value); } cmd.output().expect("run git")