Add check() methods to object classes for consistency checking.
These roughly mirror the parts of git fsck that deal with object
well-formedness, including checking the presence of required headers,
formatting of author/committer names, tree ordering, and so on. This
change does *not* include consistency checks that require touching other
objects; those will go in ObjectStore.
Note that currently many types of errors will still be raised during
object parsing proper, such as ValueErrors when trying to parse invalid
integers. In the check() method, any such exceptions are caught and
wrapped in an ObjectFormatException. The separate codepath also gives
us a place to put these checks if we decide to optimize them out of the
main object-parsing codepath.