parse_object_buffer: do not set object type

The only way that "obj" can be non-NULL is if it came from
one of the lookup_* functions. These functions always ensure
that the object has the expected type (and return NULL
otherwise), so there is no need for us to set the type.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King 2014-07-13 02:42:00 -04:00 committed by Junio C Hamano
parent fe24d396e1
commit fe0444b50b

View File

@ -213,8 +213,6 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
warning("object %s has unknown type id %d", sha1_to_hex(sha1), type); warning("object %s has unknown type id %d", sha1_to_hex(sha1), type);
obj = NULL; obj = NULL;
} }
if (obj && obj->type == OBJ_NONE)
obj->type = type;
return obj; return obj;
} }