Skip to content

Commit 367068e

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 683ff88 commit 367068e

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

shallow.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
8989
cur_depth = *(int *)commit->util;
9090
}
9191
}
92-
if (parse_commit(commit))
93-
die("invalid commit");
92+
parse_commit_or_die(commit);
9493
cur_depth++;
9594
if (cur_depth >= depth) {
9695
commit_list_insert(commit, &result);

upload-pack.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,8 +694,7 @@ static void receive_needs(void)
694694
/* make sure the real parents are parsed */
695695
unregister_shallow(object->sha1);
696696
object->parsed = 0;
697-
if (parse_commit((struct commit *)object))
698-
die("invalid commit");
697+
parse_commit_or_die((struct commit *)object);
699698
parents = ((struct commit *)object)->parents;
700699
while (parents) {
701700
add_object_array(&parents->item->object,

0 commit comments

Comments
 (0)