]> granicus.if.org Git - git/commit
fsck: stop checking commit->parent counts
authorJeff King <peff@peff.net>
Fri, 18 Oct 2019 04:49:10 +0000 (00:49 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 21 Oct 2019 02:15:23 +0000 (11:15 +0900)
commit9f07f8516d66a55954a32c544f6c0b1066bf6fa5
tree6a20f4f22a96c9279fc636613ee48ccd30c7fd93
parent9728928ec60e873a54dfa4cd34bf159fb0ae9341
fsck: stop checking commit->parent counts

In 4516338243 (builtin-fsck: reports missing parent commits,
2008-02-25), we added code to check that fsck found the same number of
parents from parsing the commit itself as we see in the commit struct we
got from parse_commit_buffer(). Back then the rationale was that the
normal commit parser might skip some bad parents.

But earlier in this series, we started treating that reliably as a
parsing error, meaning that we'd complain about it before we even hit
the code in fsck.c.

Let's drop this code, which now makes fsck_commit_buffer() completely
independent of any parsed values in the commit struct (that's
conceptually cleaner, and also opens up more refactoring options).

Note that we can also drop the MISSING_PARENT and MISSING_GRAFT fsck
identifiers. This is no loss, as these would not trigger reliably
anyway.  We'd hit them only when lookup_commit() failed, which occurs
only if we happen to have seen the object with another type already in
the same process. In most cases, we'd actually run into the problem
during the connectivity walk, not here.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
fsck.c