git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/2] sequencer: stop exporting GIT_REFLOG_ACTION

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Nov 8, 2022, 09:54 UTC
Message-ID
<16baa0cd-0797-4427-3e39-e5ffd2dca544@dunelm.org.uk>
In-Reply-To
<03cd4cdb-5f6b-11b9-1959-d58d5b544565@dunelm.org.uk>
Hi Ævar
On 07/11/2022 19:35, Phillip Wood wrote:
Show 10 quoted lines
>>> @@ -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
Previous: Phillip WoodNext: Ævar Arnfjörð Bjarmason
Message 6 of 18 in “rebase: stop setting GIT_REFLOG_ACTION”
  1. 0/2 rebase: stop setting GIT_REFLOG_ACTIONPhillip Wood via GitGitGadget, Nov 4, 2022
  2. 1/2 sequencer: stop exporting GIT_REFLOG_ACTIONPhillip Wood via GitGitGadget, Nov 4, 2022
  3. Taylor BlauNov 4, 2022
  4. Ævar Arnfjörð BjarmasonNov 7, 2022
  5. Phillip WoodNov 7, 2022
  6. Phillip WoodNov 8, 2022
  7. Ævar Arnfjörð BjarmasonNov 8, 2022
  8. 2/2 rebase: stop exporting GIT_REFLOG_ACTIONPhillip Wood via GitGitGadget, Nov 4, 2022
  9. Taylor BlauNov 4, 2022
  10. Taylor BlauNov 4, 2022
  11. Ævar Arnfjörð BjarmasonNov 7, 2022
  12. Taylor BlauNov 7, 2022
  13. 0/2 rebase: stop setting GIT_REFLOG_ACTIONPhillip Wood via GitGitGadget, Nov 9, 2022
  14. 1/2 sequencer: stop exporting GIT_REFLOG_ACTIONPhillip Wood via GitGitGadget, Nov 9, 2022
  15. 2/2 rebase: stop exporting GIT_REFLOG_ACTIONPhillip Wood via GitGitGadget, Nov 9, 2022
  16. Ævar Arnfjörð BjarmasonNov 9, 2022
  17. Phillip WoodNov 9, 2022
  18. Taylor BlauNov 9, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.