Skip to content

Commit

Permalink
testing: forward RUST_LOG environment variable
Browse files Browse the repository at this point in the history
Typically this would be used as `RUST_LOG=git_branchless=debug` or similar.
  • Loading branch information
arxanas committed Jan 7, 2024
1 parent 2768c3c commit 6c83485
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions git-branchless-lib/src/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,19 +185,26 @@ impl Git {
let git_editor = OsString::from(":");

let new_path = self.get_path_for_env();
let envs = vec![
let mut envs = vec![
("GIT_CONFIG_NOSYSTEM", OsString::from("1")),
("GIT_AUTHOR_DATE", date.clone()),
("GIT_COMMITTER_DATE", date),
("GIT_EDITOR", git_editor),
("GIT_EXEC_PATH", self.git_exec_path.as_os_str().into()),
("PATH", new_path),
(TEST_GIT, self.path_to_git.as_os_str().into()),
(
TEST_SEPARATE_COMMAND_BINARIES,
std::env::var_os(TEST_SEPARATE_COMMAND_BINARIES).unwrap_or_default(),
),
];
if let Some(test_separate_command_binaries) =
std::env::var_os(TEST_SEPARATE_COMMAND_BINARIES)
{
envs.push((
TEST_SEPARATE_COMMAND_BINARIES,
test_separate_command_binaries,
));
}
if let Some(rust_log) = std::env::var_os("RUST_LOG") {
envs.push(("RUST_LOG", rust_log));
}

envs.into_iter()
.map(|(key, value)| (OsString::from(key), value))
Expand Down

0 comments on commit 6c83485

Please sign in to comment.