Skip to content

Commit dc8bd63

Browse files
authored
Merge pull request #1876 from joshtriplett/fix-tests-in-environments-with-env-variables-set
Fix tests when `GIT_AUTHOR_NAME` or `GIT_COMMITTER_NAME` are set
2 parents 6d5f774 + 94dda22 commit dc8bd63

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

gix/tests/gix/repository/config/identity.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ use std::path::Path;
99
#[serial]
1010
fn author_included_by_hasconfig() -> crate::Result {
1111
let repo = named_subrepo_opts("make_config_repos.sh", "with-hasconfig", gix::open::Options::isolated())?;
12-
let _env = Env::new().set(
13-
"GIT_CONFIG_SYSTEM",
14-
repo.git_dir().join("system.config").display().to_string(),
15-
);
12+
let _env = Env::new()
13+
.set(
14+
"GIT_CONFIG_SYSTEM",
15+
repo.git_dir().join("system.config").display().to_string(),
16+
)
17+
.unset("GIT_AUTHOR_NAME")
18+
.unset("GIT_COMMITTER_NAME");
1619
let repo = gix::open_opts(repo.git_dir(), allow_system_options(repo.open_options().clone()))?;
1720
let author = repo.author().expect("set in system config via include")?;
1821
assert_eq!(author.name, "works");
@@ -146,7 +149,9 @@ fn author_from_different_config_sections() -> crate::Result {
146149
.set("GIT_CONFIG_GLOBAL", work_dir.join("global.config").to_str().unwrap())
147150
.set("GIT_CONFIG_SYSTEM", work_dir.join("system.config").to_str().unwrap())
148151
.set("GIT_AUTHOR_DATE", "1979-02-26 18:30:00")
152+
.unset("GIT_AUTHOR_NAME")
149153
.set("GIT_COMMITTER_DATE", "1980-02-26 18:30:00 +0000")
154+
.unset("GIT_COMMITTER_NAME")
150155
.set("EMAIL", "general@email-unused");
151156

152157
let repo = gix::open_opts(

0 commit comments

Comments
 (0)