X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=object.c;h=16793d9958a57664233b9e4468e112dfa1a8a915;hb=4d1012c3709e356107d0fb0e3bf5a39e0d5c209d;hp=7bd3fec55655584f9cf4aebc6a13de7b84a78af5;hpb=61397d4b8da2f2ab3fd767c6058ad05ca10269b8;p=git.git diff --git a/object.c b/object.c index 7bd3fec55..16793d995 100644 --- a/object.c +++ b/object.c @@ -160,8 +160,11 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t parse_tag_buffer(tag, buffer, size); obj = &tag->object; } else { + warning("object %s has unknown type id %d\n", sha1_to_hex(sha1), type); obj = NULL; } + if (obj && obj->type == OBJ_NONE) + obj->type = type; *eaten_p = eaten; return obj; } @@ -176,6 +179,7 @@ struct object *parse_object(const unsigned char *sha1) if (buffer) { struct object *obj; if (check_sha1_signature(sha1, buffer, size, typename(type)) < 0) { + free(buffer); error("sha1 mismatch %s\n", sha1_to_hex(sha1)); return NULL; } @@ -230,6 +234,11 @@ int object_list_contains(struct object_list *list, struct object *obj) } void add_object_array(struct object *obj, const char *name, struct object_array *array) +{ + add_object_array_with_mode(obj, name, array, S_IFINVALID); +} + +void add_object_array_with_mode(struct object *obj, const char *name, struct object_array *array, unsigned mode) { unsigned nr = array->nr; unsigned alloc = array->alloc; @@ -243,5 +252,6 @@ void add_object_array(struct object *obj, const char *name, struct object_array } objects[nr].item = obj; objects[nr].name = name; + objects[nr].mode = mode; array->nr = ++nr; }