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

Re: [PATCH] submodule: implement `module_name` as a builtin helper

From
Stefan Beller <sbeller@google.com>
Date
Aug 7, 2015, 21:21 UTC
Message-ID
<CAGZ79kYjaXtGurWgPk47FauLhC=k-gBjLYhepuz4gJE6Rm_8DA@mail.gmail.com>
In-Reply-To
<xmqqa8u2yf6e.fsf@gitster.dls.corp.google.com>
On Fri, Aug 7, 2015 at 2:14 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 54 quoted lines
> Stefan Beller <sbeller@google.com> writes:
>
>> On Fri, Aug 7, 2015 at 1:17 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>> Jens Lehmann <Jens.Lehmann@web.de> writes:
>>>
>>> This change...
>>>
>>>>> @@ -723,10 +733,8 @@ int fetch_populated_submodules(const struct argv_array *options,
>>>>>              if (!S_ISGITLINK(ce->ce_mode))
>>>>>                      continue;
>>>>>
>>>>> -            name = ce->name;
>>>>> -            name_for_path = unsorted_string_list_lookup(&config_name_for_path, ce->name);
>>>>> -            if (name_for_path)
>>>>> -                    name = name_for_path->util;
>>>>> +            name_for_path = submodule_name_for_path(ce->name);
>>>>> +            name =  name_for_path ? name_for_path : ce->name;
>>>
>>> ... interacts with Heiko's cached submodule config work that seems
>>> to have stalled.
>>
>> We can drop that hunk as it only uses the new method
>> `submodule_name_for_path` but doesn't change functionality.
>> So if you want to keep Heikos work, I'll just resend the patch
>> without that hunk.
>
> Does such a result even make sense?  Note that I wasn't talking
> about textual conflict.
>
> If we followed what you just said, that patch will try to directly
> read the data in config_name_for_path string list, which is removed
> by Heiko's series, if I am reading it right.
>
> In the new world order with Heiko's series, the way you grab
> submodule configuration data is to call submodule_from_path() or
> submodule_from_name() and they allow you to read from .gitmodules
> either in a commit (for historical state), the index, or from the
> working tree.  Which should be much cleaner and goes in the right
> direction in the longer term.
>
> And the best part of the story is that your module_name would be
> just calling submodule_from_path() and peeking into a field.
>
>> 2) Come up with a good thread pool abstraction
>>    (Started as "[RFC/PATCH 0/4] parallel fetch for submodules" )
>>    This abstraction (if done right) will allow us to use it in different places
>>    easily. I started it as part of "git fetch --recurse-submodules" because
>>    it is submodule related and reasonably sized
>
> I personally think this gives the most bang-for-buck.  Write that
> and expose it as "git submodule for-each-parallel", which takes the
> shell scriptlet that currently is the loop body of "while read mode
> sha1 stage sm_path" in update and clone.  You will have immediate
> and large payback.

You said that before. I feel like this is a bit to narrow. A "git submodule for-each-parallel" would be a very specific tool which we would use to make the different submodule operations parallel with ease. But it would be very submodule specifc I guess?

That's why I want to be a bit more generic and have this thread pool API done in C, such that "any for loop" in git can be easily replaced by using the thread pool. I think of "git fetch --all" specially.

Show 5 quoted lines
>
> And you do not even need module_list and module_name written in C in
> order to do so.  Not that these two are not trivial to implement, but
> the payoff from them is not as large as from for-each-parallel ;-)
>

I think I can do this for-each-parallel once I have the more generic thread pooling done. All that is left now is a good handling of stdout/stderr, which I am not yet convinced how to do it right. Maybe each task accumulates messages in two string buffers and then the thread pool will output the string buffer one a task is done.

Previous: Junio C HamanoNext: Junio C Hamano
Message 16 of 27 in “submodule: implement `module_list` as a builtin helper”
  1. 1/4 submodule: implement `module_list` as a builtin helperStefan Beller, Aug 5, 2015
  2. 2/4 submodule: implement `module_name` as a builtin helperStefan Beller, Aug 5, 2015
  3. Stefan BellerAug 5, 2015
  4. Eric SunshineAug 5, 2015
  5. Stefan BellerAug 5, 2015
  6. Jens LehmannAug 5, 2015
  7. Stefan BellerAug 5, 2015
  8. submodule: implement `module_name` as a builtin helperStefan Beller, Aug 5, 2015
  9. Jens LehmannAug 6, 2015
  10. submodule: implement `module_name` as a builtin helperStefan Beller, Aug 6, 2015
  11. Junio C HamanoAug 7, 2015
  12. Stefan BellerAug 7, 2015
  13. Junio C HamanoAug 7, 2015
  14. Stefan BellerAug 7, 2015
  15. Junio C HamanoAug 7, 2015
  16. Stefan BellerAug 7, 2015
  17. Junio C HamanoAug 7, 2015
  18. Stefan BellerAug 7, 2015
  19. Junio C HamanoAug 7, 2015
  20. Stefan BellerAug 7, 2015
  21. Junio C HamanoAug 7, 2015
  22. Stefan BellerAug 7, 2015
  23. Junio C HamanoAug 8, 2015
  24. Junio C HamanoAug 8, 2015
  25. Stefan BellerAug 10, 2015
  26. Jens LehmannAug 5, 2015
  27. Junio C HamanoAug 7, 2015

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.