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

Re: [PATCH] submodule--helper.c: add only-active to foreach

From
GGGuillaume Galeazzi <guillaume.galeazzi@gmail.com>
Date
May 13, 2020, 05:17 UTC
Message-ID
<cf25c55e-e0c8-6374-3adf-84f4314869e9@gmail.com>
In-Reply-To
<xmqq8shxc7ct.fsf@gitster.c.googlers.com>
Hi Junio
Show 21 quoted lines
> If iterating over only active ones is useful, surely it would also
> be useful to be able to iterate over only inactive ones, right?
> 
> So, before getting married too much to the use-case of "only active
> ones" and getting our eyes clouded from seeing a larger picture,
> let's see what other "traits" of submodules we can use to pick which
> ones to act on.
> 
> Are there attributes other than "is-active" that we may want to and
> can check about submodules?  There is is_submodule_populated() next
> to is_submodule_active(), which might be a candidate. IOW, what I am
> wondering is if it makes sense to extend this to
> 
> 	git submodule foreach --trait=is-active ...
> 	git submodule foreach --trait=!is-active ...
> 	git submodule foreach --trait=is-populated ...
> 
> to allow iterating only on submodules with/without given trait (I am
> not suggesting the actual option name, but merely making sure that
> 'is-active' is not anything special but one of the possibilities
> that can be used to limit the iteration using the same mechanism).

The idea that other candidate are possible seem good. But then users will need combination like is-active && !is-populated. We will end up implementing a complex code to filter based on expression which is IMHO overkill.

If is-populated is needed, that could be implemented this way:
         git submodule--helper --is-populated[=true|false]

this would allow combination with the is active filter and the previous example would be

         git submodule--helper --is-active --is-populated=false <cmd>

Regards, GG

Previous: Junio C HamanoNext: Junio C Hamano
Message 11 of 22 in “submodule--helper.c: add only-active to foreach”
  1. submodule--helper.c: add only-active to foreachGuillaume G. via GitGitGadget, May 10, 2020
  2. Shourya ShuklaMay 10, 2020
  3. Guillaume GaleazziMay 10, 2020
  4. Eric SunshineMay 10, 2020
  5. Guillaume GaleazziMay 15, 2020
  6. Shourya ShuklaMay 12, 2020
  7. Guillaume GaleazziMay 15, 2020
  8. Junio C HamanoMay 15, 2020
  9. Guillaume GaleazziMay 15, 2020
  10. Junio C HamanoMay 12, 2020
  11. Guillaume GaleazziMay 13, 2020
  12. Junio C HamanoMay 13, 2020
  13. Guillaume GaleazziMay 13, 2020
  14. Junio C HamanoMay 13, 2020
  15. Guillaume GaleazziMay 15, 2020
  16. 0/3 submodule--helper.c: add only-active to foreachGuillaume G. via GitGitGadget, May 17, 2020
  17. 1/3 submodule--helper.c: add active to foreachGuillaume Galeazzi via GitGitGadget, May 17, 2020
  18. 3/3 submodule--helper.c: add branch to foreachGuillaume Galeazzi via GitGitGadget, May 17, 2020
  19. 2/3 submodule--helper.c: add populated to foreachGuillaume Galeazzi via GitGitGadget, May 17, 2020
  20. Junio C HamanoMay 17, 2020
  21. Guillaume GaleazziMay 17, 2020
  22. Guillaume GaleazziAug 18, 2020

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.