aboutsummaryrefslogtreecommitdiff
path: root/pack-check.c
diff options
context:
space:
mode:
Diffstat (limited to 'pack-check.c')
-rw-r--r--pack-check.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/pack-check.c b/pack-check.c
index 67cb2cf72f..7378c80730 100644
--- a/pack-check.c
+++ b/pack-check.c
@@ -9,6 +9,7 @@
#include "packfile.h"
#include "object-file.h"
#include "odb.h"
+#include "odb/streaming.h"
struct idx_entry {
off_t offset;
@@ -104,6 +105,7 @@ static int verify_packfile(struct repository *r,
QSORT(entries, nr_objects, compare_entries);
for (i = 0; i < nr_objects; i++) {
+ struct odb_read_stream *stream = NULL;
void *data;
struct object_id oid;
enum object_type type;
@@ -152,7 +154,9 @@ static int verify_packfile(struct repository *r,
type) < 0)
err = error("packed %s from %s is corrupt",
oid_to_hex(&oid), p->pack_name);
- else if (!data && stream_object_signature(r, &oid) < 0)
+ else if (!data &&
+ (packfile_read_object_stream(&stream, &oid, p, entries[i].offset) < 0 ||
+ stream_object_signature(r, stream, &oid) < 0))
err = error("packed %s from %s is corrupt",
oid_to_hex(&oid), p->pack_name);
else if (fn) {
@@ -163,12 +167,14 @@ static int verify_packfile(struct repository *r,
}
if (((base_count + i) & 1023) == 0)
display_progress(progress, base_count + i);
- free(data);
+ if (stream)
+ odb_read_stream_close(stream);
+ free(data);
}
+
display_progress(progress, base_count + i);
free(entries);
-
return err;
}