diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-11-29 17:52:33 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-11-29 17:52:33 -0800 |
commit | f5a5531e4e08c22ff1c3f02c43954896b947b158 (patch) | |
tree | 3a9f543e07f7a3db4151288a4be08204aa060da3 /diff.c | |
parent | f3f973a0176d5fe7870ca4f27085d347b96307d2 (diff) | |
parent | c50c4316e1eed362bee387e4cbfbe1138957f75b (diff) | |
download | git-f5a5531e4e08c22ff1c3f02c43954896b947b158.tar.gz |
Merge branch 'np/diff-in-corrupt-repository'
* 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; } } |