pack-objects: check return value from read_sha1_file()
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Aug 25, 2007 at 01:26 UTC
2e3404c3245e1e0031ef0a6574f25e8c35d5aac3
1 file changed
+6
builtin-pack-objects.c
+6
@@ -1356,6 +1356,9 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
1356
/* Load data if not already done */
1357
if (!trg->data) {
1358
trg->data = read_sha1_file(trg_entry->idx.sha1, &type, &sz);
1359
+ if (!trg->data)
1360
+ die("object %s cannot be read",
1361
+ sha1_to_hex(trg_entry->idx.sha1));
1362
if (sz != trg_size)
1363
die("object %s inconsistent object length (%lu vs %lu)",
1364
sha1_to_hex(trg_entry->idx.sha1), sz, trg_size);
@@ -1363,6 +1366,9 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
1366
}
1367
if (!src->data) {
1368
src->data = read_sha1_file(src_entry->idx.sha1, &type, &sz);
1369
+ if (!src->data)
1370
+ die("object %s cannot be read",
1371
+ sha1_to_hex(src_entry->idx.sha1));
1372
if (sz != src_size)
1373
die("object %s inconsistent object length (%lu vs %lu)",
1374
sha1_to_hex(src_entry->idx.sha1), sz, src_size);