summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c157d37)
raw | patch | inline | side by side (parent: c157d37)
author | Junio C Hamano <junkio@cox.net> | |
Mon, 18 Apr 2005 22:07:24 +0000 (15:07 -0700) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Mon, 18 Apr 2005 22:07:24 +0000 (15:07 -0700) |
This patch fixes show-diff to detect unreadable blob and warn
instead of going ahead and crashing.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
instead of going ahead and crashing.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
show-diff.c | patch | blob | history |
diff --git a/show-diff.c b/show-diff.c
index 2bd789c261851e899bdf653c1fa59d39412c6f51..dacdd36394a30b95458221585f10f359924d89cb 100644 (file)
--- a/show-diff.c
+++ b/show-diff.c
unsigned char type[20], *p, *end;
old = read_sha1_file(ce->sha1, type, &size);
+ if (! old) {
+ error("unable to read blob object for %s (%s)", ce->name,
+ sha1_to_hex(ce->sha1));
+ return;
+ }
if (size > 0) {
int startline = 1;
int c = 0;
continue;
old = read_sha1_file(ce->sha1, type, &size);
- show_differences(ce->name, old, size);
+ if (! old)
+ error("unable to read blob object for %s (%s)",
+ ce->name, sha1_to_hex(ce->sha1));
+ else
+ show_differences(ce->name, old, size);
free(old);
}
return 0;