Verify that the object type matches for tree/commit objects even before parsing.