"Phillip Wood via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes: > 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. > @@ -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.