diff options
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 26 |
1 files changed, 24 insertions, 2 deletions
@@ -176,7 +176,7 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t obj = &tag->object; } } else { - warning("object %s has unknown type id %d\n", sha1_to_hex(sha1), type); + warning("object %s has unknown type id %d", sha1_to_hex(sha1), type); obj = NULL; } if (obj && obj->type == OBJ_NONE) @@ -198,11 +198,22 @@ struct object *parse_object(const unsigned char *sha1) if (obj && obj->parsed) return obj; + if ((obj && obj->type == OBJ_BLOB) || + (!obj && has_sha1_file(sha1) && + sha1_object_info(sha1, NULL) == OBJ_BLOB)) { + if (check_sha1_signature(repl, NULL, 0, NULL) < 0) { + error("sha1 mismatch %s", sha1_to_hex(repl)); + return NULL; + } + parse_blob_buffer(lookup_blob(sha1), NULL, 0); + return lookup_object(sha1); + } + buffer = read_sha1_file(sha1, &type, &size); if (buffer) { if (check_sha1_signature(repl, buffer, size, typename(type)) < 0) { free(buffer); - error("sha1 mismatch %s\n", sha1_to_hex(repl)); + error("sha1 mismatch %s", sha1_to_hex(repl)); return NULL; } @@ -275,3 +286,14 @@ void object_array_remove_duplicates(struct object_array *array) array->nr = dst; } } + +void clear_object_flags(unsigned flags) +{ + int i; + + for (i=0; i < obj_hash_size; i++) { + struct object *obj = obj_hash[i]; + if (obj) + obj->flags &= ~flags; + } +} |