]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'pw/sequencer-reflog-use-after-free'
authorJunio C Hamano <gitster@pobox.com>
Mon, 19 May 2025 23:02:44 +0000 (16:02 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 19 May 2025 23:02:44 +0000 (16:02 -0700)
Use-after-free fix in the sequencer.

* pw/sequencer-reflog-use-after-free:
  sequencer: rework reflog message handling
  sequencer: move reflog message functions

1  2 
sequencer.c
t/t3430-rebase-merges.sh

diff --cc sequencer.c
index b5c4043757e948aedaad0782dff947373e2f45ea,c4b3cb245ce4af17dab9a96abb75d4e3962424ba..4e77da475ccebcd57d6228452f9626ae8f635564
@@@ -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));
Simple merge