]> git.ipfire.org Git - thirdparty/git.git/commitdiff
fsck: remove redundant date timestamp check
authorJeff King <peff@peff.net>
Tue, 18 Nov 2025 09:12:25 +0000 (04:12 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 18 Nov 2025 17:36:11 +0000 (09:36 -0800)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
fsck.c

diff --git a/fsck.c b/fsck.c
index 3696f1b849ad9f5d3e4499453d0d3585acc3a646..98b16a9e58406095d2433110968d0da40d1134af 100644 (file)
--- a/fsck.c
+++ b/fsck.c
@@ -919,7 +919,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 != '-') ||