aboutsummaryrefslogtreecommitdiff
path: root/builtin/commit.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2013-10-24 04:53:19 -0400
committerJunio C Hamano <gitster@pobox.com>2013-10-24 15:43:50 -0700
commit5e7d4d3e932432131d0f8f4195e0061ecf644865 (patch)
tree69826f91be44e4096551bc75e884f0f1db7d8db5 /builtin/commit.c
parent0064053bd76ba385e1b5d51b6175bc17bc507804 (diff)
downloadgit-5e7d4d3e932432131d0f8f4195e0061ecf644865.tar.gz
git-5e7d4d3e932432131d0f8f4195e0061ecf644865.tar.xz
assume parse_commit checks for NULL commit
The parse_commit function will check whether it was passed a NULL commit pointer, and if so, return an error. There is no need for callers to check this separately. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/commit.c')
-rw-r--r--builtin/commit.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index 10acc53f8..89f65f2b8 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1311,7 +1311,7 @@ static void print_summary(const char *prefix, const unsigned char *sha1,
commit = lookup_commit(sha1);
if (!commit)
die(_("couldn't look up newly created commit"));
- if (!commit || parse_commit(commit))
+ if (parse_commit(commit))
die(_("could not parse newly created commit"));
strbuf_addstr(&format, "format:%h] %s");
@@ -1503,7 +1503,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
current_head = NULL;
else {
current_head = lookup_commit_or_die(sha1, "HEAD");
- if (!current_head || parse_commit(current_head))
+ if (parse_commit(current_head))
die(_("could not parse HEAD commit"));
}
argc = parse_and_validate_options(argc, argv, builtin_commit_options,