just playing with tangled
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cli/tests: Prevent git.subprocess from reading outside git config

A subset of cli tests could fail if the system /etc/gitconfig had
configuration interfering with the tests. The cause seems to be running
of `jj` commands that would in turn use a `git` subprocess.

Fix this by setting `GIT_CONFIG_SYSTEM` and `GIT_CONFIG_GLOBAL`, like
in `hermetic_git`.

Fixes #6159

+7 -3
+3
cli/tests/common/test_environment.rs
··· 120 120 // executables like `git` from the PATH. 121 121 cmd.env("PATH", std::env::var_os("PATH").unwrap_or_default()); 122 122 cmd.env("HOME", self.home_dir.to_str().unwrap()); 123 + // Prevent git.subprocess from reading outside git config 124 + cmd.env("GIT_CONFIG_SYSTEM", "/dev/null"); 125 + cmd.env("GIT_CONFIG_GLOBAL", "/dev/null"); 123 126 cmd.env("JJ_CONFIG", self.config_path.to_str().unwrap()); 124 127 cmd.env("JJ_USER", "Test User"); 125 128 cmd.env("JJ_EMAIL", "test.user@example.com");
+4 -3
cli/tests/test_git_remotes.rs
··· 439 439 .open(work_dir.root().join(".jj/repo/store/git/config")) 440 440 .unwrap(); 441 441 // `git clone` adds branch configuration like this. 442 - writeln!(config_file, "[branch \"test\"]").unwrap(); 443 - writeln!(config_file, "\tremote = foo").unwrap(); 444 - writeln!(config_file, "\tmerge = refs/heads/test").unwrap(); 442 + let eol = if cfg!(windows) { "\r\n" } else { "\n" }; 443 + write!(config_file, "[branch \"test\"]{eol}").unwrap(); 444 + write!(config_file, "\tremote = foo{eol}").unwrap(); 445 + write!(config_file, "\tmerge = refs/heads/test{eol}").unwrap(); 445 446 drop(config_file); 446 447 447 448 let output = work_dir.run_jj(["git", "remote", "rename", "foo", "bar"]);