test(git-utils): isolate filter policy cardinality tests

This commit is contained in:
Chris Bookholt
2026-07-02 07:22:29 -07:00
parent 6da314e14f
commit f047aa7f31
2 changed files with 48 additions and 0 deletions
+16
View File
@@ -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
@@ -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");