From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Subject: [PATCH 5/6] use parse_commit_or_die instead of custom message
Date: Thu, 24 Oct 2013 04:54:01 -0400 [thread overview]
Message-ID: <20131024085401.GE1346@sigill.intra.peff.net> (raw)
In-Reply-To: <20131024085213.GA1267@sigill.intra.peff.net>
Many calls to parse_commit detect errors and die. In some
cases, the custom error messages are more useful than what
parse_commit_or_die could produce, because they give some
context, like which ref the commit came from. Some, however,
just say "invalid commit". Let's convert the latter to use
parse_commit_or_die; its message is slightly more informative,
and it makes the error more consistent throughout git.
Signed-off-by: Jeff King <peff@peff.net>
---
shallow.c | 3 +--
upload-pack.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/shallow.c b/shallow.c
index cdf37d6..961cf6f 100644
--- a/shallow.c
+++ b/shallow.c
@@ -90,8 +90,7 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
cur_depth = *(int *)commit->util;
}
}
- if (parse_commit(commit))
- die("invalid commit");
+ parse_commit_or_die(commit);
cur_depth++;
if (cur_depth >= depth) {
commit_list_insert(commit, &result);
diff --git a/upload-pack.c b/upload-pack.c
index a6c54e0..abe6636 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -649,8 +649,7 @@ static void receive_needs(void)
/* make sure the real parents are parsed */
unregister_shallow(object->sha1);
object->parsed = 0;
- if (parse_commit((struct commit *)object))
- die("invalid commit");
+ parse_commit_or_die((struct commit *)object);
parents = ((struct commit *)object)->parents;
while (parents) {
add_object_array(&parents->item->object,
--
1.8.4.1.898.g8bf8a41.dirty
next prev parent reply other threads:[~2013-10-24 8:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-24 8:52 [PATCH 0/6] fix some parse_commit segfaults Jeff King
2013-10-24 8:52 ` [PATCH 1/6] log_tree_diff: die when we fail to parse a commit Jeff King
2013-10-24 8:53 ` [PATCH 2/6] assume parse_commit checks commit->object.parsed Jeff King
2013-10-24 8:53 ` [PATCH 3/6] assume parse_commit checks for NULL commit Jeff King
2013-10-24 8:53 ` [PATCH 4/6] use parse_commit_or_die instead of segfaulting Jeff King
2013-10-24 8:54 ` Jeff King [this message]
2013-10-24 8:54 ` [PATCH 6/6] checkout: do not die when leaving broken detached HEAD Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131024085401.GE1346@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).