Closed
Description
Hi,
the below code snipped creates a segmentation fault:
fn main() {
let repo = git2::Repository::open(".").unwrap();
let config = repo.config().unwrap();
let entries_iter = config.entries(None).unwrap();
let entries: Vec<_> = entries_iter.map(Result::unwrap).collect();
for entry in &entries {
println!("name: {}", entry.name().unwrap());
}
}
Output:
$ ./target/debug/git-segfault
[1] 498461 segmentation fault (core dumped)
The issue appears when collecting the entries of ConfigEntries
and then iterating over them. The following code works just fine:
fn main() {
let repo = git2::Repository::open(".").unwrap();
let config = repo.config().unwrap();
for entry in &config.entries(None).unwrap() {
println!("name: {}", entry.unwrap().name().unwrap());
}
}
Thank you for any help!
Metadata
Metadata
Assignees
Labels
No labels