Hi Ævar
On 07/11/2022 19:35, Phillip Wood wrote:
@@ -5116,7 +5121,7 @@ static int single_pick(struct repository *r,
TODO_PICK : TODO_REVERT;
item.commit = cmit;
- setenv(GIT_REFLOG_ACTION, action_name(opts), 0);
+ opts->reflog_message = sequencer_reflog_action(opts);
return do_pick_commit(r, &item, opts, 0, &check_todo);
Here you're adding a new memory leak, which you can see if you run
e.g. the 1st test of ./t1013-read-tree-submodule.sh before & after this
change.
What's a read-tree test using rebase for? I find the submodule tests
completely incomprehensible. It is calling
test_submodule_switch_recursing_with_args() which does not call rebase
directly but who knows what is going on in all the helper functions.
Have you got a simple example of a test which shows a new leak?
I'm not sure how, opts->reflog_message will be a copy of
opts->reflog_action which is freed at the end of the rebase. I'll have a
proper look tomorrow to see if I'm missing something.
So it is possible this is showing up because I think we only free the
heap allocated members of opts in sequencer_remove_state() and that is
not called when we stop for a conflict resolution, a break command, a
failed exec or a rescheduled pick/reset etc. The way to fix that would
be to refactor sequencer_remove_state() to create replay_opts_release()
and call that from builtin/{revert,rebase}.c
As that is unrelated to removing the setenv() calls which is the focus
of this series I will not be doing that in this series.
Best Wishes
Phillip