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

Re: [PATCH] submodule: use cheaper check for submodule pushes

From
Stefan Beller <sbeller@google.com>
Date
Jul 13, 2017, 20:54 UTC
Message-ID
<CAGZ79kZouNBxOKr7X8j6wqebp3Wh3cDqhYR-t_PxaF7AwQ0Wzg@mail.gmail.com>
In-Reply-To
<20170713204854.GA158114@aiede.mtv.corp.google.com>
On Thu, Jul 13, 2017 at 1:48 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 40 quoted lines
> Hi,
>
> Stefan Beller wrote:
>
>> Yes we are safe, because the function itself only spawns a child process
>> (not using any of the objects).
>>
>> It's only caller push_unpushed_submodules also doesn't rely on objects
>> loaded after calling push_submodule.
>>
>> The caller of push_unpushed_submodules (transport.c, transport_push)
>> also doesn't need submodule objects loaded.
>
> Thanks for looking into it.  This is what the commit message should
> say to help reviewers or people trying to understand it later.  The
> footnotes don't help and are distracting, except that it makes sense
> to point out the original GSoC patch to say the alternate submodule
> odb wasn't needed even then.
>
> E.g.:
>
>  Subject: push: do not add submodule odb as an alternate when recursing on demand
>
>  "git push --recurse-submodules=on-demand" adds each submodule as an
>  alternate with add_submodule_odb before checking whether the
>  submodule has anything to push and pushing it if so.
>
>  However, it never accesses any objects from the submodule.  In the
>  parent process it uses the submodule's ref database to see if there
>  is anything to push.  The actual push (which does rely on objects)
>  occurs in a child process.
>
>  The same was try when this call was originally added in
>  v1.7.11-rc0~111^2 (push: teach --recurse-submodules the on-demand
>  option, 2012-03-29).  Most likely it was added by analogy with
>  fetch --recurse-submodules=on-demand, which did use the submodule's
>  object database.
>
>  Use is_submodule_populated_gently instead, which is simpler and
>  cheaper.

Thanks for giving a good example of commit message that I could use in a reroll.

Show 6 quoted lines
> With such a commit message change, this seems like a reasonable change
> in principle (though I haven't looked carefully to verify it).
>
> My one doubt is the is_submodule_populated_gently.  Why are we using
> that instead of simpler is_submodule_populated?  The names and API
> comments don't explain.

One could posit this is laziness of thinking. See 15cdc64776 (make is_submodule_populated gently, 2017-03-14), and discover there is no non-gentle version of is_submodule_populated. And for each new use, it may be cheaper to just use the gentle version instead of adding a non-gentle version.

Thanks, Stefan

Previous: Jonathan NiederNext: Stefan Beller
Message 9 of 20 in “submodule: use cheaper check for submodule pushes”
  1. submodule: use cheaper check for submodule pushesStefan Beller, Jul 12, 2017
  2. Jonathan NiederJul 13, 2017
  3. Stefan BellerJul 13, 2017
  4. Junio C HamanoJul 13, 2017
  5. Stefan BellerJul 13, 2017
  6. Junio C HamanoJul 13, 2017
  7. Stefan BellerJul 13, 2017
  8. Jonathan NiederJul 13, 2017
  9. Stefan BellerJul 13, 2017
  10. push: do not add submodule odb as an alternate when recursing on demandStefan Beller, Aug 15, 2017
  11. Jonathan NiederAug 15, 2017
  12. Jonathan NiederAug 15, 2017
  13. Stefan BellerAug 15, 2017
  14. Junio C HamanoAug 15, 2017
  15. Stefan BellerAug 15, 2017
  16. Junio C HamanoAug 16, 2017
  17. Stefan BellerAug 16, 2017
  18. Jonathan NiederAug 16, 2017
  19. Stefan BellerAug 16, 2017
  20. Heiko VoigtAug 16, 2017

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.