pack-objects: check return value from read_sha1_file()
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
ab43e495dd
commit
2e3404c324
@ -1356,6 +1356,9 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
|
|||||||
/* Load data if not already done */
|
/* Load data if not already done */
|
||||||
if (!trg->data) {
|
if (!trg->data) {
|
||||||
trg->data = read_sha1_file(trg_entry->idx.sha1, &type, &sz);
|
trg->data = read_sha1_file(trg_entry->idx.sha1, &type, &sz);
|
||||||
|
if (!trg->data)
|
||||||
|
die("object %s cannot be read",
|
||||||
|
sha1_to_hex(trg_entry->idx.sha1));
|
||||||
if (sz != trg_size)
|
if (sz != trg_size)
|
||||||
die("object %s inconsistent object length (%lu vs %lu)",
|
die("object %s inconsistent object length (%lu vs %lu)",
|
||||||
sha1_to_hex(trg_entry->idx.sha1), sz, trg_size);
|
sha1_to_hex(trg_entry->idx.sha1), sz, trg_size);
|
||||||
@ -1363,6 +1366,9 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
|
|||||||
}
|
}
|
||||||
if (!src->data) {
|
if (!src->data) {
|
||||||
src->data = read_sha1_file(src_entry->idx.sha1, &type, &sz);
|
src->data = read_sha1_file(src_entry->idx.sha1, &type, &sz);
|
||||||
|
if (!src->data)
|
||||||
|
die("object %s cannot be read",
|
||||||
|
sha1_to_hex(src_entry->idx.sha1));
|
||||||
if (sz != src_size)
|
if (sz != src_size)
|
||||||
die("object %s inconsistent object length (%lu vs %lu)",
|
die("object %s inconsistent object length (%lu vs %lu)",
|
||||||
sha1_to_hex(src_entry->idx.sha1), sz, src_size);
|
sha1_to_hex(src_entry->idx.sha1), sz, src_size);
|
||||||
|
Loading…
Reference in New Issue
Block a user