Merge branch 'ab/fsck-unexpected-type'
"git fsck" has been taught to report mismatch between expected and actual types of an object better. * ab/fsck-unexpected-type: fsck: report invalid object type-path combinations fsck: don't hard die on invalid object types object-file.c: stop dying in parse_loose_header() object-file.c: return ULHR_TOO_LONG on "header too long" object-file.c: use "enum" return type for unpack_loose_header() object-file.c: simplify unpack_loose_short_header() object-file.c: make parse_loose_header_extended() public object-file.c: return -1, not "status" from unpack_loose_header() object-file.c: don't set "typep" when returning non-zero cat-file tests: test for current --allow-unknown-type behavior cat-file tests: add corrupt loose object test cat-file tests: test for missing/bogus object with -t, -s and -p cat-file tests: move bogus_* variable declarations earlier fsck tests: test for garbage appended to a loose object fsck tests: test current hash/type mismatch behavior fsck tests: refactor one test to use a sub-repo fsck tests: add test for fsck-ing an unknown type
This commit is contained in:
4
object.c
4
object.c
@ -279,7 +279,7 @@ struct object *parse_object(struct repository *r, const struct object_id *oid)
|
||||
if ((obj && obj->type == OBJ_BLOB && repo_has_object_file(r, oid)) ||
|
||||
(!obj && repo_has_object_file(r, oid) &&
|
||||
oid_object_info(r, oid, NULL) == OBJ_BLOB)) {
|
||||
if (check_object_signature(r, repl, NULL, 0, NULL) < 0) {
|
||||
if (check_object_signature(r, repl, NULL, 0, NULL, NULL) < 0) {
|
||||
error(_("hash mismatch %s"), oid_to_hex(oid));
|
||||
return NULL;
|
||||
}
|
||||
@ -290,7 +290,7 @@ struct object *parse_object(struct repository *r, const struct object_id *oid)
|
||||
buffer = repo_read_object_file(r, oid, &type, &size);
|
||||
if (buffer) {
|
||||
if (check_object_signature(r, repl, buffer, size,
|
||||
type_name(type)) < 0) {
|
||||
type_name(type), NULL) < 0) {
|
||||
free(buffer);
|
||||
error(_("hash mismatch %s"), oid_to_hex(repl));
|
||||
return NULL;
|
||||
|
Reference in New Issue
Block a user