Merge branch 'rs/replay-wrong-onto-fix'

"git replay --onto=<commit> ...", when <commit> is mistyped,
started to segfault with recent change, which has been corrected.

* rs/replay-wrong-onto-fix:
  replay: move onto NULL check before first use
This commit is contained in:
Junio C Hamano 2025-12-22 14:57:48 +09:00
commit 24a51fef5b

View File

@ -454,6 +454,9 @@ int cmd_replay(int argc,
determine_replay_mode(repo, &revs.cmdline, onto_name, &advance_name, determine_replay_mode(repo, &revs.cmdline, onto_name, &advance_name,
&onto, &update_refs); &onto, &update_refs);
if (!onto) /* FIXME: Should handle replaying down to root commit */
die("Replaying down to root commit is not supported yet!");
/* Build reflog message */ /* Build reflog message */
if (advance_name_opt) if (advance_name_opt)
strbuf_addf(&reflog_msg, "replay --advance %s", advance_name_opt); strbuf_addf(&reflog_msg, "replay --advance %s", advance_name_opt);
@ -472,9 +475,6 @@ int cmd_replay(int argc,
} }
} }
if (!onto) /* FIXME: Should handle replaying down to root commit */
die("Replaying down to root commit is not supported yet!");
if (prepare_revision_walk(&revs) < 0) { if (prepare_revision_walk(&revs) < 0) {
ret = error(_("error preparing revisions")); ret = error(_("error preparing revisions"));
goto cleanup; goto cleanup;