From 543067ecf94c9d52ef3ebdec1d2ffe8785c43c6b Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Wed, 06 Jul 2022 13:15:53 +0100 Subject: [PATCH] Don't error on peel_to_tag failing --- src/git.rs | 15 +++++++++------ src/methods/filters.rs | 2 +- src/methods/mod.rs | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/git.rs b/src/git.rs index 47df5b5..74fcf82 100644 --- a/src/git.rs +++ a/src/git.rs @@ -102,12 +102,12 @@ commit: commit.into(), }); } else if ref_.is_tag() { - let tag = ref_.peel_to_tag().unwrap(); - - built_refs.tag.push(Tag { - name: ref_.shorthand().unwrap().to_string(), - tagger: tag.tagger().map(Into::into), - }); + if let Ok(tag) = ref_.peel_to_tag() { + built_refs.tag.push(Tag { + name: ref_.shorthand().unwrap().to_string(), + tagger: tag.tagger().map(Into::into), + }); + } } } @@ -284,8 +284,7 @@ name: v.name().unwrap().to_string(), email: v.email().unwrap().to_string(), email_md5: format!("{:x}", md5::compute(v.email_bytes())), - time: OffsetDateTime::from_unix_timestamp(v.when().seconds()) - .unwrap(), + time: OffsetDateTime::from_unix_timestamp(v.when().seconds()).unwrap(), } } } diff --git a/src/methods/filters.rs b/src/methods/filters.rs index 286009f..4a98605 100644 --- a/src/methods/filters.rs +++ a/src/methods/filters.rs @@ -1,3 +1,3 @@ pub fn timeago(s: time::OffsetDateTime) -> Result { Ok(timeago::Formatter::new().convert((time::OffsetDateTime::now_utc() - s).unsigned_abs())) -}+} diff --git a/src/methods/mod.rs b/src/methods/mod.rs index 515ab4b..c48f363 100644 --- a/src/methods/mod.rs +++ a/src/methods/mod.rs @@ -1,3 +1,3 @@ +pub mod filters; pub mod index; pub mod repo; -pub mod filters;-- rgit 0.1.3