aboutsummaryrefslogtreecommitdiff
path: root/object-file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2026-03-05 10:04:49 -0800
committerJunio C Hamano <gitster@pobox.com>2026-03-05 10:04:49 -0800
commitd93be9cbcaf80f4d1ff56a3d7aa5d722236b6eac (patch)
tree2febbd0e230148934704a2eebe27fcd7d58780c4 /object-file.c
parentdb227bce2224b55b11954a5f292a0b035b7d9279 (diff)
parent13eb65d36615d7269df053015bddf7987ef6d923 (diff)
downloadgit-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-file.c')
-rw-r--r--object-file.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/object-file.c b/object-file.c
index b8265021f9..3094140055 100644
--- a/object-file.c
+++ b/object-file.c
@@ -129,18 +129,15 @@ int check_object_signature(struct repository *r, const struct object_id *oid,
return !oideq(oid, &real_oid) ? -1 : 0;
}
-int stream_object_signature(struct repository *r, const struct object_id *oid)
+int stream_object_signature(struct repository *r,
+ struct odb_read_stream *st,
+ const struct object_id *oid)
{
struct object_id real_oid;
- struct odb_read_stream *st;
struct git_hash_ctx c;
char hdr[MAX_HEADER_LEN];
int hdrlen;
- st = odb_read_stream_open(r->objects, oid, NULL);
- if (!st)
- return -1;
-
/* Generate the header */
hdrlen = format_object_header(hdr, sizeof(hdr), st->type, st->size);
@@ -160,7 +157,6 @@ int stream_object_signature(struct repository *r, const struct object_id *oid)
git_hash_update(&c, buf, readlen);
}
git_hash_final_oid(&real_oid, &c);
- odb_read_stream_close(st);
return !oideq(oid, &real_oid) ? -1 : 0;
}