Skip to content

Commit 33be0e0

Browse files
committed
try to prevent 'git' reading user and system configuration (#960)
1 parent b629f8a commit 33be0e0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tests/tools/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,13 +497,16 @@ fn configure_command<'a>(
497497
args: &[String],
498498
script_result_directory: &Path,
499499
) -> &'a mut std::process::Command {
500+
let never_path = if cfg!(windows) { "-" } else { ":" };
500501
cmd.args(args)
501502
.stdout(std::process::Stdio::piped())
502503
.stderr(std::process::Stdio::piped())
503504
.current_dir(script_result_directory)
504505
.env_remove("GIT_DIR")
505506
.env_remove("GIT_ASKPASS")
506507
.env_remove("SSH_ASKPASS")
508+
.env("GIT_CONFIG_SYSTEM", never_path)
509+
.env("GIT_CONFIG_GLOBAL", never_path)
507510
.env("GIT_TERMINAL_PROMPT", "false")
508511
.env("GIT_AUTHOR_DATE", "2000-01-01 00:00:00 +0000")
509512
.env("GIT_AUTHOR_EMAIL", "author@example.com")

0 commit comments

Comments
 (0)