🏡 index : ~doyle/rgit.git

author Jordan Doyle <jordan@doyle.la> 2022-07-06 13:15:53.0 +01:00:00
committer Jordan Doyle <jordan@doyle.la> 2022-07-06 13:16:15.0 +01:00:00
commit
543067ecf94c9d52ef3ebdec1d2ffe8785c43c6b [patch]
tree
13366dd633b65db0c4279c601b99c73959bef273
parent
8ecf34a1bdf85356a5e2da3cdc966339f6cb67b3
download
543067ecf94c9d52ef3ebdec1d2ffe8785c43c6b.tar.gz

Don't error on peel_to_tag failing



Diff

 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<String, askama::Error> {
    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;