make find_pack_revindex() aware of the nasty world

It currently calls die() whenever given offset is not found thinking
that such thing should never happen.  But this offset may come from a
corrupted pack whych _could_ happen and not be found.  Callers should
deal with this possibility gracefully instead.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Nicolas Pitre
2008-10-29 19:02:49 -04:00
committed by Junio C Hamano
parent 03d660150c
commit 08698b1e32
3 changed files with 16 additions and 7 deletions

View File

@ -140,7 +140,8 @@ struct revindex_entry *find_pack_revindex(struct packed_git *p, off_t ofs)
else
lo = mi + 1;
} while (lo < hi);
die("internal error: pack revindex corrupt");
error("bad offset for revindex");
return NULL;
}
void discard_revindex(void)