From: Christian Couder Date: Fri, 07 Apr 2023 07:24:04 GMT Subject: [PATCH 03/14] replay: die() instead of failing assert() Message-ID: <20230407072415.1360068-4-christian.couder@gmail.com> In-Reply-To: <20230407072415.1360068-1-christian.couder@gmail.com> From: Elijah Newren 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 Signed-off-by: Elijah Newren Signed-off-by: Christian Couder --- builtin/replay.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/builtin/replay.c b/builtin/replay.c index ca931dee41..16efac11ab 100644 --- a/builtin/replay.c +++ b/builtin/replay.c @@ -170,7 +170,12 @@ int cmd_replay(int argc, const char **argv, const char *prefix) fprintf(stderr, "Rebasing %s...\r", 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; next_tree = get_commit_tree(commit); -- 2.40.0.228.gb2eb5bb98e