Skip to content

Commit aff490b

Browse files
committed
testing: forward RUST_LOG environment variable
Typically this would be used as `RUST_LOG=git_branchless=debug` or similar.
1 parent 895bfd5 commit aff490b

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

git-branchless-lib/src/testing.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,19 +185,26 @@ impl Git {
185185
let git_editor = OsString::from(":");
186186

187187
let new_path = self.get_path_for_env();
188-
let envs = vec![
188+
let mut envs = vec![
189189
("GIT_CONFIG_NOSYSTEM", OsString::from("1")),
190190
("GIT_AUTHOR_DATE", date.clone()),
191191
("GIT_COMMITTER_DATE", date),
192192
("GIT_EDITOR", git_editor),
193193
("GIT_EXEC_PATH", self.git_exec_path.as_os_str().into()),
194194
("PATH", new_path),
195195
(TEST_GIT, self.path_to_git.as_os_str().into()),
196-
(
197-
TEST_SEPARATE_COMMAND_BINARIES,
198-
std::env::var_os(TEST_SEPARATE_COMMAND_BINARIES).unwrap_or_default(),
199-
),
200196
];
197+
if let Some(test_separate_command_binaries) =
198+
std::env::var_os(TEST_SEPARATE_COMMAND_BINARIES)
199+
{
200+
envs.push((
201+
TEST_SEPARATE_COMMAND_BINARIES,
202+
test_separate_command_binaries,
203+
));
204+
}
205+
if let Some(rust_log) = std::env::var_os("RUST_LOG") {
206+
envs.push(("RUST_LOG", rust_log));
207+
}
201208

202209
envs.into_iter()
203210
.map(|(key, value)| (OsString::from(key), value))

0 commit comments

Comments
 (0)