aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-11-29 17:52:33 -0800
committerJunio C Hamano <gitster@pobox.com>2010-11-29 17:52:33 -0800
commit09efc4510dd11b559404d200286ae988fa66c88f (patch)
tree8c14ec09ebc20a36987857c57621e70a775dbc2b /builtin
parentf5a5531e4e08c22ff1c3f02c43954896b947b158 (diff)
parent71064a956b25ef519eab340e364d0bc0e786bd11 (diff)
downloadgit-09efc4510dd11b559404d200286ae988fa66c88f.tar.gz
git-09efc4510dd11b559404d200286ae988fa66c88f.tar.xz
Merge branch 'np/pack-broken-boundary'
* np/pack-broken-boundary: make pack-objects a bit more resilient to repo corruption
Diffstat (limited to 'builtin')
-rw-r--r--builtin/pack-objects.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index f8eba53c8..3cbeb299d 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -1298,9 +1298,23 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
read_lock();
src->data = read_sha1_file(src_entry->idx.sha1, &type, &sz);
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",
sha1_to_hex(src_entry->idx.sha1));
+ }
if (sz != src_size)
die("object %s inconsistent object length (%lu vs %lu)",
sha1_to_hex(src_entry->idx.sha1), sz, src_size);