summaryrefslogtreecommitdiff
path: root/builtin-blame.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-08-25 08:26:20 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-08-25 15:33:47 (GMT)
commitab43e495dd095547c3ada9ae13b72f9741a7f0d2 (patch)
tree8ac198adc1f2439c0548b0c7c1e65017c47f80d5 /builtin-blame.c
parent0058a33a8eb5a8bfcfc5f5e769a2517cff4b73f1 (diff)
downloadgit-ab43e495dd095547c3ada9ae13b72f9741a7f0d2.zip
git-ab43e495dd095547c3ada9ae13b72f9741a7f0d2.tar.gz
git-ab43e495dd095547c3ada9ae13b72f9741a7f0d2.tar.bz2
blame: check return value from read_sha1_file()
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-blame.c')
-rw-r--r--builtin-blame.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/builtin-blame.c b/builtin-blame.c
index 0519339..dc88a95 100644
--- a/builtin-blame.c
+++ b/builtin-blame.c
@@ -98,6 +98,10 @@ static char *fill_origin_blob(struct origin *o, mmfile_t *file)
num_read_blob++;
file->ptr = read_sha1_file(o->blob_sha1, &type,
(unsigned long *)(&(file->size)));
+ if (!file->ptr)
+ die("Cannot read blob %s for path %s",
+ sha1_to_hex(o->blob_sha1),
+ o->path);
o->file = *file;
}
else
@@ -1384,6 +1388,9 @@ static void get_commit_info(struct commit *commit,
unsigned long size;
commit->buffer =
read_sha1_file(commit->object.sha1, &type, &size);
+ if (!commit->buffer)
+ die("Cannot read commit %s",
+ sha1_to_hex(commit->object.sha1));
}
ret->author = author_buf;
get_ac_line(commit->buffer, "\nauthor ",
@@ -2382,6 +2389,10 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
sb.final_buf = read_sha1_file(o->blob_sha1, &type,
&sb.final_buf_size);
+ if (!sb.final_buf)
+ die("Cannot read blob %s for path %s",
+ sha1_to_hex(o->blob_sha1),
+ path);
}
num_read_blob++;
lno = prepare_lines(&sb);