caio.co/de/caca

Fallback to default date when signature is broken

Also get rid of a lint that makes things harder to read.
Id
38a2277227de1bc616ebd35149c276732fd39313
Author
Caio
Commit time
2025-08-06T09:15:56+02:00

Modified urso/src/lib.rs

@@ -36,7 +36,6
clippy::manual_ok_or,
clippy::map_err_ignore,
clippy::map_flatten,
- clippy::map_unwrap_or,
clippy::match_same_arms,
clippy::match_wildcard_for_single_variants,
clippy::match_wild_err_arm,
@@ -83,7 +82,7
// re-export
pub use gix::{
actor::SignatureRef,
- date::parse as parse_date,
+ date::parse_header,
date::Time,
mailmap::Snapshot as Mailmap,
objs::{tree::EntryMode, CommitRef, TagRef},

Modified caca/src/repo/mod.rs

@@ -1719,7 +1719,15
}
}

- let time = convert(urso::parse_date(sig.time, None).expect("FIXME"));
+ // map_or_else reads backwards. it's awful.
+ #[allow(clippy::map_unwrap_or)]
+ let time = urso::parse_header(sig.time)
+ .map(convert)
+ .unwrap_or_else(|| {
+ tracing::trace!(sig.time, "bad raw date header in signature");
+ DateTime::default()
+ });
+
Signature {
name,
email,