diff options
Diffstat (limited to 'source/parsing.c')
| -rw-r--r-- | source/parsing.c | 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 16 insertions, 2 deletions
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; + } } } |
