From f047aa7f31837b0ea65ec1ea914d32d2162b6796 Mon Sep 17 00:00:00 2001 From: Chris Bookholt Date: Thu, 2 Jul 2026 07:22:29 -0700 Subject: [PATCH] test(git-utils): isolate filter policy cardinality tests --- codex-rs/git-utils/src/apply.rs | 16 +++++++++++ codex-rs/git-utils/src/patch_paths_tests.rs | 32 +++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/codex-rs/git-utils/src/apply.rs b/codex-rs/git-utils/src/apply.rs index e79be238a3..932a39ad99 100644 --- a/codex-rs/git-utils/src/apply.rs +++ b/codex-rs/git-utils/src/apply.rs @@ -586,6 +586,22 @@ mod tests { #[test] fn apply_then_revert_success() { let _g = env_lock().lock().unwrap(); + if std::env::var_os("CODEX_GIT_UTILS_APPLY_ENV_CHILD").is_none() { + let config_dir = tempfile::tempdir().expect("config tempdir"); + let global_config = config_dir.path().join("global.gitconfig"); + let system_config = config_dir.path().join("system.gitconfig"); + std::fs::write(&global_config, "").expect("empty global config"); + std::fs::write(&system_config, "").expect("empty system config"); + run_isolated_test( + "apply::tests::apply_then_revert_success", + &[ + ("GIT_CONFIG_GLOBAL", global_config.as_os_str()), + ("GIT_CONFIG_SYSTEM", system_config.as_os_str()), + ], + ); + return; + } + let repo = init_repo(); let root = repo.path(); // Seed file and commit original content diff --git a/codex-rs/git-utils/src/patch_paths_tests.rs b/codex-rs/git-utils/src/patch_paths_tests.rs index 44a93f04b8..f0485ad8ca 100644 --- a/codex-rs/git-utils/src/patch_paths_tests.rs +++ b/codex-rs/git-utils/src/patch_paths_tests.rs @@ -717,6 +717,22 @@ fn stage_effective_paths( #[test] fn standalone_stage_paths_uses_one_source_authorization_and_one_filter_read() { + if std::env::var_os("CODEX_GIT_UTILS_PATH_ENV_CHILD").is_none() { + let config_dir = tempfile::tempdir().expect("config tempdir"); + let global_config = config_dir.path().join("global.gitconfig"); + let system_config = config_dir.path().join("system.gitconfig"); + std::fs::write(&global_config, "").expect("empty global config"); + std::fs::write(&system_config, "").expect("empty system config"); + run_isolated_test( + "patch_paths::tests::standalone_stage_paths_uses_one_source_authorization_and_one_filter_read", + &[ + ("GIT_CONFIG_GLOBAL", global_config.as_os_str()), + ("GIT_CONFIG_SYSTEM", system_config.as_os_str()), + ], + ); + return; + } + let repo = init_repo(); let root = repo.path(); std::fs::write(root.join("single.txt"), "single\n").expect("write staged file"); @@ -732,6 +748,22 @@ fn standalone_stage_paths_uses_one_source_authorization_and_one_filter_read() { #[test] fn composed_staging_freshly_observes_a_new_clean_driver_and_attribute() { + if std::env::var_os("CODEX_GIT_UTILS_PATH_ENV_CHILD").is_none() { + let config_dir = tempfile::tempdir().expect("config tempdir"); + let global_config = config_dir.path().join("global.gitconfig"); + let system_config = config_dir.path().join("system.gitconfig"); + std::fs::write(&global_config, "").expect("empty global config"); + std::fs::write(&system_config, "").expect("empty system config"); + run_isolated_test( + "patch_paths::tests::composed_staging_freshly_observes_a_new_clean_driver_and_attribute", + &[ + ("GIT_CONFIG_GLOBAL", global_config.as_os_str()), + ("GIT_CONFIG_SYSTEM", system_config.as_os_str()), + ], + ); + return; + } + let repo = init_repo(); let root = repo.path(); std::fs::write(root.join("file.txt"), "base\n").expect("write base file");