Re: [PATCH 2/2] sequencer: rework reflog message handling
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 9, 2025, 20:37 UTC
- Message-ID
- <xmqqfrhdzfjc.fsf@gitster.g>
- In-Reply-To
- <90c6912478683d96ef18b521506c703a2467585e.1746807747.git.gitgitgadget@gmail.com>
"Phillip Wood via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 8 quoted lines
> Fix this by creating the reflog message nearer to where the commit is > created and storing it in a local variable which is passed as an > additional parameter to run_git_commit() rather than storing the message > in `struct replay_ctx`. This makes it harder to forget to call > `reflog_message()` before creating a commit and using a variable with a > narrower scope means that a stale value cannot carried across a from one > iteration of the loop to the next which should prevent any similar > use-after-free bugs in the future.
Nice.
Show 19 quoted lines
> @@ -1124,10 +1119,10 @@ static int run_command_silent_on_success(struct child_process *cmd) > * author metadata. > */ > static int run_git_commit(const char *defmsg, > + const char *reflog_action, > struct replay_opts *opts, > unsigned int flags) > ... > static int try_to_commit(struct repository *r, > struct strbuf *msg, const char *author, > + const char *reflog_action, > struct replay_opts *opts, unsigned int flags, > struct object_id *oid) > ... > static int do_commit(struct repository *r, > const char *msg_file, const char *author, > + const char *reflog_action, > struct replay_opts *opts, unsigned int flags, > struct object_id *oid)
OK. We no longer have the reflog_action as a part of replay_opts, but they are almost always passed together, so making them sit together in the list of parameters does make sense.
Will queue. Thanks.