Skip to content

Commit e71b65a

Browse files
test for verifying that the Repository::config() function returns a config object that have the local repo as highest prio
1 parent d8d0717 commit e71b65a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/repo.rs

+21
Original file line numberDiff line numberDiff line change
@@ -3621,4 +3621,25 @@ mod tests {
36213621
// reverting twice restores `foo` file
36223622
assert!(foo_file.exists());
36233623
}
3624+
3625+
#[test]
3626+
fn smoke_config_write_and_read() {
3627+
let td = TempDir::new().unwrap();
3628+
let path = td.path();
3629+
3630+
let repo = Repository::init(path).unwrap();
3631+
3632+
let mut config = repo.config().unwrap();
3633+
3634+
config.set_bool("commit.gpgsign", false).unwrap();
3635+
3636+
let c = fs::read_to_string(path.join(".git").join("config")).unwrap();
3637+
3638+
assert!(c.contains("[commit]"));
3639+
assert!(c.contains("gpgsign = false"));
3640+
3641+
let config = repo.config().unwrap();
3642+
3643+
assert!(!config.get_bool("commit.gpgsign").unwrap());
3644+
}
36243645
}

0 commit comments

Comments
 (0)