diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-12-09 10:36:39 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-12-09 10:36:39 -0800 |
commit | 8577def6fc1dda3f18a284162aba07819fbcbcd4 (patch) | |
tree | 8673e563e044c1faeead872c365a7f9a1582e8d9 /diff.c | |
parent | a59c87265b917eb0d1b95c73ed829d47ee2ded6b (diff) | |
parent | c50c4316e1eed362bee387e4cbfbe1138957f75b (diff) | |
download | git-8577def6fc1dda3f18a284162aba07819fbcbcd4.tar.gz |
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
Diffstat (limited to 'diff.c')
-rw-r--r-- | diff.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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; } } |