mirror of
https://github.com/git/git
synced 2024-10-30 04:01:21 +00:00
Merge branch 'np/pack-broken-boundary'
* np/pack-broken-boundary: make pack-objects a bit more resilient to repo corruption
This commit is contained in:
commit
09efc4510d
1 changed files with 15 additions and 1 deletions
|
@ -1298,9 +1298,23 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
|
||||||
read_lock();
|
read_lock();
|
||||||
src->data = read_sha1_file(src_entry->idx.sha1, &type, &sz);
|
src->data = read_sha1_file(src_entry->idx.sha1, &type, &sz);
|
||||||
read_unlock();
|
read_unlock();
|
||||||
if (!src->data)
|
if (!src->data) {
|
||||||
|
if (src_entry->preferred_base) {
|
||||||
|
static int warned = 0;
|
||||||
|
if (!warned++)
|
||||||
|
warning("object %s cannot be read",
|
||||||
|
sha1_to_hex(src_entry->idx.sha1));
|
||||||
|
/*
|
||||||
|
* Those objects are not included in the
|
||||||
|
* resulting pack. Be resilient and ignore
|
||||||
|
* them if they can't be read, in case the
|
||||||
|
* pack could be created nevertheless.
|
||||||
|
*/
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
die("object %s cannot be read",
|
die("object %s cannot be read",
|
||||||
sha1_to_hex(src_entry->idx.sha1));
|
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 a new issue