From d3aa4c43edb0e3d385a13a9915ea96bc55c22b06 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 17 Oct 2026 17:09:14 -1000 Subject: Show an odd pushed date rather than die on it A date past what the system holds, a zone that is no hhmm offset, or a date earlier than its own westward offset all made git die inside show_date, which took the summary, refs, log, commit and feed pages of the repository down. They are now clamped as git's own log clamps them. --- source/parsing.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'source/parsing.c') diff --git a/source/parsing.c b/source/parsing.c index dab81fa..71ecdb7 100644 --- a/source/parsing.c +++ b/source/parsing.c @@ -71,10 +71,24 @@ static void parse_user(const char *line, char **name, char **email, timestamp_t strbuf_addch(&address, '>'); *email = strbuf_detach(&address, NULL); + // Clamped as git's own show_ident_date clamps them: a date past + // what the system can hold becomes the epoch, and a zone that is + // no hhmm offset becomes UTC, where git's date code would die on + // either and take the whole page with it. if (ident.date_begin) *date = parse_timestamp(ident.date_begin, NULL, 10); - if (ident.tz_begin) - *tz = atoi(ident.tz_begin); + if (date_overflows(*date)) + *date = 0; + if (ident.tz_begin) { + long zone = strtol(ident.tz_begin, NULL, 10); + long west = zone < 0 ? -zone : 0; + + *tz = zone > -10000 && zone < 10000 ? zone : 0; + // A date earlier than its own westward offset has no + // local time before the epoch to show. + if (*date < (timestamp_t)((west / 100) * 60 + west % 100) * 60) + *tz = 0; + } } } -- cgit