aboutsummaryrefslogtreecommitdiff
path: root/builtin/fast-export.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2013-10-24 04:53:46 -0400
committerJunio C Hamano <gitster@pobox.com>2013-10-24 15:43:50 -0700
commit683ff884cce955cc331929d857fac9d6bd69f46a (patch)
treee2008ae24bd2672c58d9d1410e95552d6f74e05b /builtin/fast-export.c
parent5e7d4d3e932432131d0f8f4195e0061ecf644865 (diff)
downloadgit-683ff884cce955cc331929d857fac9d6bd69f46a.tar.gz
git-683ff884cce955cc331929d857fac9d6bd69f46a.tar.xz
use parse_commit_or_die instead of segfaulting
Some unchecked calls to parse_commit should obviously die on error, because their next step is to start looking at the parsed fields, which will cause a segfault. These are obvious candidates for parse_commit_or_die, which will be a strict improvement in behavior. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/fast-export.c')
-rw-r--r--builtin/fast-export.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 8e1905874..7785c2217 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -286,7 +286,7 @@ static void handle_commit(struct commit *commit, struct rev_info *rev)
rev->diffopt.output_format = DIFF_FORMAT_CALLBACK;
- parse_commit(commit);
+ parse_commit_or_die(commit);
author = strstr(commit->buffer, "\nauthor ");
if (!author)
die ("Could not find author in commit %s",
@@ -307,7 +307,7 @@ static void handle_commit(struct commit *commit, struct rev_info *rev)
if (commit->parents &&
get_object_mark(&commit->parents->item->object) != 0 &&
!full_tree) {
- parse_commit(commit->parents->item);
+ parse_commit_or_die(commit->parents->item);
diff_tree_sha1(commit->parents->item->tree->object.sha1,
commit->tree->object.sha1, "", &rev->diffopt);
}