Skip to content

Commit f05df7f

Browse files
peffgitster
authored andcommitted
fsck: remove redundant date timestamp check
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 8e43090 (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>
1 parent 830424d commit f05df7f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fsck.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ static int fsck_ident(const char **ident, const char *ident_end,
919919
return report(options, oid, type, FSCK_MSG_ZERO_PADDED_DATE, "invalid author/committer line - zero-padded date");
920920
if (date_overflows(parse_timestamp(p, &end, 10)))
921921
return report(options, oid, type, FSCK_MSG_BAD_DATE_OVERFLOW, "invalid author/committer line - date causes integer overflow");
922-
if ((end == p || *end != ' '))
922+
if (*end != ' ')
923923
return report(options, oid, type, FSCK_MSG_BAD_DATE, "invalid author/committer line - bad date");
924924
p = end + 1;
925925
if ((*p != '+' && *p != '-') ||

0 commit comments

Comments
 (0)