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

Re: [PATCH v4 1/2] for-each-repo: new command used for multi-repo operations

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 28, 2013, 17:45 UTC
Message-ID
<7vham1xktx.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20130128081006.GA2434@elie.Belkin>
Jonathan Nieder <jrnieder@gmail.com> writes:
> Tracing backwards: it would be really nice to be able to do
>
> 	git for-each-repo git grep -e foo -- '*.c'

This is a very good example that shows the command that is run in the repositories found may want pathspecs passed, but at the same time, makes me realize that these repositories have to be fairly uniform for this command to be useful. For example, 'src/*.c' or 'inc/*.h' pathspecs wouldn't be useful unless majority if not all projects the loop finds follow that layout convention. This is not necessarily limited to pathspecs, of course. Unless they all have the 'next' branch "git for-each-repo checkout next" would not work, etc. etc.

As to the pathspec limiting to affect the loop itself, not the argument given to the command that is run, I don't think it is absolutely needed; I am perfectly fine with declaring that for-each-repo goes to repositories in all subdirectories without limit, especially if doing so will make the UI issues we have to deal with simpler.

As to the "option to the command, not to the subcommand, -a option", I have been assuming that it was a joke patch, but if "git -a grep" turns out to be really useful, "submodule foreach" that iterates over the submodules may also want to have such a short and sweet mechanism. Between "for-each-repo" and "submodule foreach", I do not yet have a strong opinion on which one deserves it more.

Come to think of it, is there a reason why "for-each-repo" should not be an extention to "submodule foreach"? We can view this as visiting repositories that _could_ be registered as a submodule, in addition to iterating over the registered submodules, no?

If these two are unified, then we do not have to even worry about which one deserves "git -a" more.

Previous: Junio C HamanoNext: Lars Hjemli
Message 10 of 18 in “for-each-repo: new command for multi-repo operations”
  1. 0/2 for-each-repo: new command for multi-repo operationsLars Hjemli, Jan 27, 2013
  2. 1/2 for-each-repo: new command used for multi-repo operationsLars Hjemli, Jan 27, 2013
  3. Junio C HamanoJan 27, 2013
  4. John KeepingJan 27, 2013
  5. Junio C HamanoJan 27, 2013
  6. Lars HjemliJan 28, 2013
  7. Jonathan NiederJan 28, 2013
  8. Lars HjemliJan 28, 2013
  9. Junio C HamanoJan 28, 2013
  10. Junio C HamanoJan 28, 2013
  11. Lars HjemliJan 28, 2013
  12. Junio C HamanoJan 28, 2013
  13. Lars HjemliJan 28, 2013
  14. Jens LehmannJan 28, 2013
  15. Junio C HamanoJan 28, 2013
  16. Jens LehmannJan 28, 2013
  17. Junio C HamanoFeb 4, 2013
  18. 2/2 git: rewrite `git -a` to become a git-for-each-repo commandLars Hjemli, Jan 27, 2013

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.