From: Junio C Hamano Date: Mon, 19 May 2025 23:02:44 +0000 (-0700) Subject: Merge branch 'pw/sequencer-reflog-use-after-free' X-Git-Tag: v2.50.0-rc0~35 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0b8d22fd4030832fa64933721fa162feaa9c69d9;p=thirdparty%2Fgit.git Merge branch 'pw/sequencer-reflog-use-after-free' Use-after-free fix in the sequencer. * pw/sequencer-reflog-use-after-free: sequencer: rework reflog message handling sequencer: move reflog message functions --- 0b8d22fd4030832fa64933721fa162feaa9c69d9 diff --cc sequencer.c index b5c4043757,c4b3cb245c..4e77da475c --- a/sequencer.c +++ b/sequencer.c @@@ -2501,15 -2546,9 +2537,15 @@@ static int do_pick_commit(struct reposi *check_todo = !!(flags & EDIT_MSG); if (!res && reword) { fast_forward_edit: - res = run_git_commit(NULL, reflog_action, opts, EDIT_MSG | - VERIFY_MSG | AMEND_MSG | - (flags & ALLOW_EMPTY)); + /* + * To reword we amend the commit we just + * picked or fast-forwarded. As the commit has + * already been picked we want to use the same + * set of commit flags regardless of how we + * got here. + */ + flags = EDIT_MSG | VERIFY_MSG | AMEND_MSG | ALLOW_EMPTY; - res = run_git_commit(NULL, opts, flags); ++ res = run_git_commit(NULL, reflog_action, opts, flags); *check_todo = 1; } } @@@ -4947,9 -4958,8 +4948,8 @@@ static int pick_commits(struct reposito struct replay_ctx *ctx = opts->ctx; int res = 0, reschedule = 0; - ctx->reflog_message = sequencer_reflog_action(opts); if (opts->allow_ff) - assert(!(opts->signoff || opts->no_commit || + ASSERT(!(opts->signoff || opts->no_commit || opts->record_origin || should_edit(opts) || opts->committer_date_is_author_date || opts->ignore_date));