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

Re: [PATCHv3 0/5] Fix --recurse-submodules for submodule worktree changes

From
Stefan Beller <sbeller@google.com>
Date
Jan 3, 2018, 21:16 UTC
Message-ID
<CAGZ79kbC5tsL8R-tUBxHoZzxYiqiWwYS61F7cLfTZeb0Wu1LGA@mail.gmail.com>
In-Reply-To
<xmqqo9mahdll.fsf@gitster.mtv.corp.google.com>
On Wed, Jan 3, 2018 at 12:49 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 26 quoted lines
> Stefan Beller <sbeller@google.com> writes:
>
>> Thanks Junio for review of this series!
>> The only change in this version of the series is
>>
>> --- a/unpack-trees.c
>> +++ b/unpack-trees.c
>> @@ -2140,7 +2140,7 @@ int oneway_merge(const struct cache_entry * const *src,
>>                                 update |= CE_UPDATE;
>>                 }
>>                 if (S_ISGITLINK(old->ce_mode) && should_update_submodules() &&
>> -                   !verify_uptodate(old, o))
>> +                   o->update && !verify_uptodate(old, o))
>>                         update |= CE_UPDATE;
>>                 add_entry(o, old, update, 0);
>>
>
> Sounds OK.
>
> I wonder why o->update is not at the very beginning of the &&-chain,
> though.  After all, the one above this addition begins with o->reset
> && o->update *not* because of the performance concern, but primarily
> due to logic flow.  I.e. "if we are resetting and updating the
> working tree, then..." comes first before saying "we may need to
> flip CE_UPDATE bit in update variable if the file in the working
> tree is not up to date and it is within a narrow checkout area".

It shows that I work too much with submodules. ;) "If we have a submodule and ..." seemed to be the important part when writing the patch.

> Of course, because verify_uptodate() is rather expensive, checking
> o->update before that makes sense from micro-optimization's point of
> view, too.

I would think S_ISGITLINK, should_update_submodules as well as o->update are all on the same order of magnitude of costs (some couple number of operations) when compared to verify_uptodate (spawning processes), so as long as verify_uptodate goes last we'd be fine.

>
> So after thinking aloud like the above, I am reasonably sure that
> you want to check o->update as the very first thing in this new if
> statement.

Thanks for double checking and thinking about the code base with a less submodule centric point of view.

Mind to squash it locally or want me to resend? For a resend I'll wait a couple of days to see if there are more comments needing to be addressed.

Show 16 quoted lines
>
>> v2:
>> I dropped the patch to `same()` as I realized we only need to fix the
>> oneway_merge function, the others (two, three way merge) are fine as
>> they have the checks already in place.
>
> This is a bit flawed argument, no?  Checking working tree paths
> unconditionally in same(), which does not even know if we are
> touching the working tree paths, is broken.  Unless "they have the
> checks already in place" refers to checks that bypasses calls to
> same() when we are not touching working tree paths, that is, but
> obviously that is not what is going on.
>
> Will queue.  Thanks for working on this.
>
>
Previous: Junio C HamanoNext: Stefan Beller
Message 32 of 38 in “Fix --recurse-submodules for submodule worktree changes”
  1. 0/5 Fix --recurse-submodules for submodule worktree changesStefan Beller, Dec 19, 2017
  2. 1/5 t/lib-submodule-update.sh: clarify testStefan Beller, Dec 19, 2017
  3. 3/5 t/lib-submodule-update.sh: add new test for submodule internal changeStefan Beller, Dec 19, 2017
  4. Jonathan NiederDec 19, 2017
  5. Stefan BellerDec 19, 2017
  6. 2/5 t/lib-submodule-update.sh: Fix test ignoring ignored files in submodulesStefan Beller, Dec 19, 2017
  7. Junio C HamanoDec 22, 2017
  8. Stefan BellerDec 27, 2017
  9. 4/5 unpack-trees: Fix same() for submodulesStefan Beller, Dec 19, 2017
  10. 5/5 submodule: submodule_move_head omits old argument in forced caseStefan Beller, Dec 19, 2017
  11. Jonathan NiederDec 19, 2017
  12. Stefan BellerDec 19, 2017
  13. Jonathan NiederDec 19, 2017
  14. Jonathan NiederDec 20, 2017
  15. Stefan BellerDec 20, 2017
  16. Stefan BellerDec 20, 2017
  17. 0/5 Fix --recurse-submodules for submodule worktree changesStefan Beller, Dec 27, 2017
  18. 1/5 t/helper/test-lazy-name-hash: fix compilationStefan Beller, Dec 27, 2017
  19. 2/5 t/lib-submodule-update.sh: clarify testStefan Beller, Dec 27, 2017
  20. 3/5 t/lib-submodule-update.sh: Fix test ignoring ignored files in submodulesStefan Beller, Dec 27, 2017
  21. 5/5 submodule: submodule_move_head omits old argument in forced caseStefan Beller, Dec 27, 2017
  22. 4/5 unpack-trees: oneway_merge to update submodulesStefan Beller, Dec 27, 2017
  23. Junio C HamanoJan 2, 2018
  24. Stefan BellerJan 2, 2018
  25. 0/5 Fix --recurse-submodules for submodule worktree changesStefan Beller, Jan 3, 2018
  26. 1/5 t/helper/test-lazy-name-hash: fix compilationStefan Beller, Jan 3, 2018
  27. 2/5 t/lib-submodule-update.sh: clarify testStefan Beller, Jan 3, 2018
  28. 3/5 t/lib-submodule-update.sh: Fix test ignoring ignored files in submodulesStefan Beller, Jan 3, 2018
  29. 5/5 submodule: submodule_move_head omits old argument in forced caseStefan Beller, Jan 3, 2018
  30. 4/5 unpack-trees: oneway_merge to update submodulesStefan Beller, Jan 3, 2018
  31. Junio C HamanoJan 3, 2018
  32. Stefan BellerJan 3, 2018
  33. 0/4 Fix --recurse-submodules for submodule worktree changesStefan Beller, Jan 5, 2018
  34. 1/4 t/lib-submodule-update.sh: clarify testStefan Beller, Jan 5, 2018
  35. 2/4 t/lib-submodule-update.sh: Fix test ignoring ignored files in submodulesStefan Beller, Jan 5, 2018
  36. 3/4 unpack-trees: oneway_merge to update submodulesStefan Beller, Jan 5, 2018
  37. 4/4 submodule: submodule_move_head omits old argument in forced caseStefan Beller, Jan 5, 2018
  38. Junio C HamanoJan 9, 2018

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.