Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Merge branch 'np/diff-in-corrupt-repository' into maint
author
Junio C Hamano
<gitster@pobox.com>
Thu, 9 Dec 2010 18:36:39 +0000
(10:36 -0800)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 9 Dec 2010 18:36:39 +0000
(10:36 -0800)
* np/diff-in-corrupt-repository:
diff: don't presume empty file when corresponding object is missing
diff.c
patch
|
blob
|
history
raw
(from parent 1:
a59c872
)
diff --git
a/diff.c
b/diff.c
index c8a7ceea02ff732f85df19d894cc5ab56ea6648e..8256f313e4a680308a7959bdd6544f5bd461846c 100644
(file)
--- a/
diff.c
+++ b/
diff.c
@@
-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;
}
}