Skip to content

Commit a9df61a

Browse files
newrenchriscool
authored andcommitted
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 <[email protected]> Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Christian Couder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d46da6d commit a9df61a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

builtin/replay.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,12 @@ int cmd_replay(int argc, const char **argv, const char *prefix)
179179

180180
fprintf(stderr, "Rebasing %s...\r",
181181
oid_to_hex(&commit->object.oid));
182-
assert(commit->parents && !commit->parents->next);
182+
183+
if (!commit->parents)
184+
die(_("replaying down to root commit is not supported yet!"));
185+
if (commit->parents->next)
186+
die(_("replaying merge commits is not supported yet!"));
187+
183188
base = commit->parents->item;
184189

185190
next_tree = repo_get_commit_tree(the_repository, commit);

0 commit comments

Comments
 (0)