[PATCH v2 7/9] fsck: remove redundant date timestamp check
- From
Jeff King <peff@peff.net>
- Date
- Nov 18, 2025, 09:12 UTC
- Message-ID
- <20251118091225.GG529192@coredump.intra.peff.net>
- In-Reply-To
- <20251118091127.GA4175601@coredump.intra.peff.net>
After calling "parse_timestamp(p, &end, 10)", we complain if "p == end", which would imply that we did not see any digits at all. But we know this cannot be the case, since we would have bailed already if we did not see any digits, courtesy of extra checks added by 8e4309038f (fsck: do not assume NUL-termination of buffers, 2023-01-19). Since then, checking "p == end" is redundant and we can drop it.
This will make our lives a little easier as we refactor further.
Signed-off-by: Jeff King <peff@peff.net> --- fsck.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fsck.c b/fsck.c index 2ee72d573d..266c965cec 100644 --- a/fsck.c +++ b/fsck.c @@ -920,7 +920,7 @@ static int fsck_ident(const char **ident, const char *ident_end, return report(options, oid, type, FSCK_MSG_ZERO_PADDED_DATE, "invalid author/committer line - zero-padded date"); if (date_overflows(parse_timestamp(p, &end, 10))) return report(options, oid, type, FSCK_MSG_BAD_DATE_OVERFLOW, "invalid author/committer line - date causes integer overflow"); - if ((end == p || *end != ' ')) + if (*end != ' ') return report(options, oid, type, FSCK_MSG_BAD_DATE, "invalid author/committer line - bad date"); p = end + 1; if ((*p != '+' && *p != '-') ||
-- 2.52.0.278.gadc6434dc3