mirror of
https://github.com/git/git
synced 2024-11-05 18:59:29 +00:00
replay: die() instead of failing assert()
It's not a good idea for regular Git commands to use an assert() to check for things that could happen but are not supported. Let's die() with an explanation of the issue instead. Co-authored-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
d46da6d90b
commit
a9df61ace3
1 changed files with 6 additions and 1 deletions
|
@ -179,7 +179,12 @@ int cmd_replay(int argc, const char **argv, const char *prefix)
|
||||||
|
|
||||||
fprintf(stderr, "Rebasing %s...\r",
|
fprintf(stderr, "Rebasing %s...\r",
|
||||||
oid_to_hex(&commit->object.oid));
|
oid_to_hex(&commit->object.oid));
|
||||||
assert(commit->parents && !commit->parents->next);
|
|
||||||
|
if (!commit->parents)
|
||||||
|
die(_("replaying down to root commit is not supported yet!"));
|
||||||
|
if (commit->parents->next)
|
||||||
|
die(_("replaying merge commits is not supported yet!"));
|
||||||
|
|
||||||
base = commit->parents->item;
|
base = commit->parents->item;
|
||||||
|
|
||||||
next_tree = repo_get_commit_tree(the_repository, commit);
|
next_tree = repo_get_commit_tree(the_repository, commit);
|
||||||
|
|
Loading…
Reference in a new issue