mirror of
https://github.com/starship/starship.git
synced 2024-11-22 16:23:17 +01:00
fix(git_commit): remove unwraps (#2743)
This commit is contained in:
parent
c58d127974
commit
78b84c9f34
@ -46,13 +46,18 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
|
||||
if !config.tag_disabled {
|
||||
// Let's get repo tags names
|
||||
let tag_names = git_repo.tag_names(None).ok()?;
|
||||
let tag_and_refs = tag_names.iter().flat_map(|name| {
|
||||
let full_tag = format!("refs/tags/{}", name.unwrap());
|
||||
let tag_and_refs = tag_names.iter().flatten().flat_map(|name| {
|
||||
let full_tag = format!("refs/tags/{}", name);
|
||||
let tag_obj = git_repo.find_reference(&full_tag)?.peel_to_tag()?;
|
||||
let sig_obj = tag_obj.tagger().unwrap();
|
||||
git_repo
|
||||
.find_reference(&full_tag)
|
||||
.map(|reference| (String::from(name.unwrap()), sig_obj.when(), reference))
|
||||
let sig_obj = tag_obj.tagger();
|
||||
git_repo.find_reference(&full_tag).map(|reference| {
|
||||
(
|
||||
String::from(name),
|
||||
// fall back to oldest + 1s time if sig_obj is unavailable
|
||||
sig_obj.map_or(git2::Time::new(1, 0), |s| s.when()),
|
||||
reference,
|
||||
)
|
||||
})
|
||||
});
|
||||
|
||||
let mut tag_name = String::new();
|
||||
|
Loading…
Reference in New Issue
Block a user