diff options
| author | Junio C Hamano <gitster@pobox.com> | 2026-03-05 10:04:49 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-03-05 10:04:49 -0800 |
| commit | d93be9cbcaf80f4d1ff56a3d7aa5d722236b6eac (patch) | |
| tree | 2febbd0e230148934704a2eebe27fcd7d58780c4 /object.c | |
| parent | db227bce2224b55b11954a5f292a0b035b7d9279 (diff) | |
| parent | 13eb65d36615d7269df053015bddf7987ef6d923 (diff) | |
| download | git-d93be9cbcaf80f4d1ff56a3d7aa5d722236b6eac.tar.xz | |
Merge branch 'ps/fsck-stream-from-the-right-object-instance'
"fsck" iterates over packfiles and its access to pack data caused
the list to be permuted, which caused it to loop forever; the code
to access pack data by "fsck" has been updated to avoid this.
* ps/fsck-stream-from-the-right-object-instance:
pack-check: fix verification of large objects
packfile: expose function to read object stream for an offset
object-file: adapt `stream_object_signature()` to take a stream
t/helper: improve "genrandom" test helper
Diffstat (limited to 'object.c')
| -rw-r--r-- | object.c | 19 |
1 files changed, 16 insertions, 3 deletions
@@ -6,6 +6,7 @@ #include "object.h" #include "replace-object.h" #include "object-file.h" +#include "odb/streaming.h" #include "blob.h" #include "statinfo.h" #include "tree.h" @@ -343,9 +344,21 @@ struct object *parse_object_with_flags(struct repository *r, if ((!obj || obj->type == OBJ_NONE || obj->type == OBJ_BLOB) && odb_read_object_info(r->objects, oid, NULL) == OBJ_BLOB) { - if (!skip_hash && stream_object_signature(r, repl) < 0) { - error(_("hash mismatch %s"), oid_to_hex(oid)); - return NULL; + if (!skip_hash) { + struct odb_read_stream *stream = odb_read_stream_open(r->objects, oid, NULL); + + if (!stream) { + error(_("unable to open object stream for %s"), oid_to_hex(oid)); + return NULL; + } + + if (stream_object_signature(r, stream, repl) < 0) { + error(_("hash mismatch %s"), oid_to_hex(oid)); + odb_read_stream_close(stream); + return NULL; + } + + odb_read_stream_close(stream); } parse_blob_buffer(lookup_blob(r, oid)); return lookup_object(r, oid); |
