mirror of
https://github.com/git/git
synced 2024-09-13 13:24:41 +00:00
use parse_commit_or_die instead of custom message
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
683ff884cc
commit
367068e0dd
|
@ -89,8 +89,7 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
|
||||||
cur_depth = *(int *)commit->util;
|
cur_depth = *(int *)commit->util;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (parse_commit(commit))
|
parse_commit_or_die(commit);
|
||||||
die("invalid commit");
|
|
||||||
cur_depth++;
|
cur_depth++;
|
||||||
if (cur_depth >= depth) {
|
if (cur_depth >= depth) {
|
||||||
commit_list_insert(commit, &result);
|
commit_list_insert(commit, &result);
|
||||||
|
|
|
@ -694,8 +694,7 @@ static void receive_needs(void)
|
||||||
/* make sure the real parents are parsed */
|
/* make sure the real parents are parsed */
|
||||||
unregister_shallow(object->sha1);
|
unregister_shallow(object->sha1);
|
||||||
object->parsed = 0;
|
object->parsed = 0;
|
||||||
if (parse_commit((struct commit *)object))
|
parse_commit_or_die((struct commit *)object);
|
||||||
die("invalid commit");
|
|
||||||
parents = ((struct commit *)object)->parents;
|
parents = ((struct commit *)object)->parents;
|
||||||
while (parents) {
|
while (parents) {
|
||||||
add_object_array(&parents->item->object,
|
add_object_array(&parents->item->object,
|
||||||
|
|
Loading…
Reference in a new issue