summaryrefslogtreecommitdiff
path: root/rev-tree.c
diff options
context:
space:
mode:
authorPetr Baudis <pasky@ucw.cz>2005-05-11 23:01:20 +0200
committerPetr Baudis <xpasky@machine.sinus.cz>2005-05-11 23:01:20 +0200
commit06cd3b94b27c285fc9877e7c6d9e1f35fbc0a7a4 (patch)
tree0a5307ed5088a9016ccd2b31e57236ae98d507a7 /rev-tree.c
parent1c9da46da4fe5cf99c5f6ab251419d0f412ecfba (diff)
downloadgit-06cd3b94b27c285fc9877e7c6d9e1f35fbc0a7a4.tar.gz
rev-tree now handles commit problems better
This fixes possible crashes in case of broken commit tree, and makes rev-tree die in case it cannot parse a given commit.
Diffstat (limited to 'rev-tree.c')
-rw-r--r--rev-tree.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/rev-tree.c b/rev-tree.c
index bfc8b12579..c2909da172 100644
--- a/rev-tree.c
+++ b/rev-tree.c
@@ -51,11 +51,11 @@ void process_commit(unsigned char *sha1)
struct commit_list *parents;
struct commit *obj = lookup_commit(sha1);
- if (obj->object.parsed)
+ if (obj && obj->object.parsed)
return;
+ if (!obj || parse_commit(obj))
+ die("unable to parse commit (%s)", sha1_to_hex(sha1));
- parse_commit(obj);
-
parents = obj->parents;
while (parents) {
process_commit(parents->item->object.sha1);