Skip to content

Commit 6f69336

Browse files
LemmingAvalanchegitster
authored andcommitted
replay: die if we cannot parse object
`parse_object` can return `NULL`. That will in turn make `repo_peel_to_type` return the same. Let’s die fast and descriptively with the `*_or_die` variant. Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent f67f7dd commit 6f69336

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

builtin/replay.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static struct commit *peel_committish(struct repository *repo,
4242

4343
if (repo_get_oid(repo, name, &oid))
4444
die(_("'%s' is not a valid commit-ish for %s"), name, mode);
45-
obj = parse_object(repo, &oid);
45+
obj = parse_object_or_die(repo, &oid, name);
4646
return (struct commit *)repo_peel_to_type(repo, name, 0, obj,
4747
OBJ_COMMIT);
4848
}

0 commit comments

Comments
 (0)