1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-08 13:36:15 +02:00

Merge branch 'np/diff-in-corrupt-repository' into maint

* np/diff-in-corrupt-repository:
  diff: don't presume empty file when corresponding object is missing
This commit is contained in:
Junio C Hamano 2010-12-09 10:36:39 -08:00
commit 8577def6fc

8
diff.c
View File

@ -2391,10 +2391,14 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only)
}
else {
enum object_type type;
if (size_only)
if (size_only) {
type = sha1_object_info(s->sha1, &s->size);
else {
if (type < 0)
die("unable to read %s", sha1_to_hex(s->sha1));
} else {
s->data = read_sha1_file(s->sha1, &type, &s->size);
if (!s->data)
die("unable to read %s", sha1_to_hex(s->sha1));
s->should_free = 1;
}
}