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

Re: [RFC/PATCH] add update to branch support for "floating submodules"

From
Jens Lehmann <jens.lehmann@web.de>
Date
Feb 6, 2012, 21:32 UTC
Message-ID
<4F3046D7.2010304@web.de>
In-Reply-To
<CABURp0rt=LcjMfDU61m0de-gLpX1a3x3vhb0zVxCbceSvD9jFw@mail.gmail.com>
Am 06.02.2012 18:31, schrieb Phil Hord:
Show 11 quoted lines
> On Wed, Feb 1, 2012 at 5:37 PM, Jens Lehmann <Jens.Lehmann@web.de> wrote:
>> Hmm, I really think the fact that submodules are unaware that they
>> are part of a superproject is a feature. I'd prefer seeing that kind
>> of problem being tackled by the CI server and/or user education. Or
>> maybe a pre-commit hook which issues a warning in that case?
> 
> I agree that submodule isolation is a feature essential to the
> architecture of git and the submodules implementation.  But it is also
> a limitation, not just of this example.  A pre-commit hook is a nice
> idea, but it doesn't help 'git status' (which is the standard go-to
> answer point for "where am I").

Yes, this feature also is a limitation. To put it in other words: I want each submodule to be a full fledged repo of its own. IMO it must always be possible to just clone a submodule without any superproject and run any git command in it. And the other way around: each superproject must be usable as a submodule in another superproject. That makes adding some kind of "superproject awareness" in a sane way rather difficult, as a repo can't say "I live in a superproject" or "I am the topmost project".

> This has me thinking more about recursing siblings now, though. I find
> myself typing something like this quite a lot:
>     git submodule foreach 'git grep "someFunction" || :'

There was an attempt to teach git grep the --recurse-submodules option, but unfortunately it looks like this didn't lead anywhere so far.

> Or worse (in that the UI is more unwieldy):
>     git submodule foreach 'git log --oneline "-SsomeFunction" || :'

This could also be done by teaching git log the --recurse-submodules option. Me thinks in the long run a lot of git commands should learn that option to make it easy to optionally include submodules in whatever they are doing. But my focus is on recursive checkout for the next time, so I have no idea when I find some time to do that.

Show 8 quoted lines
> But what I want is this:
>     git --git-dir=${TOP}/../.git grep --recurse-submodules "someFunction"
> 
> But not really, because I am lazy and that is too much typing.
>     git grep --include-siblings "someFunction"
> 
> Maybe I can add a "sib" macro to get this:
>     git sib grep "someFunction"

And from what you where saying earlier a "git sib status" would be nice too? What about using alias commands for that functionality? They could point to a script which searches the topmost repo and calls "git submodule foreach 'git <command> "$@" || :'" from there ...

Previous: Phil HordNext: Brandon Casey
Message 25 of 27 in “add update to branch support for "floating submodules"”
  1. add update to branch support for "floating submodules"Heiko Voigt, Nov 9, 2011
  2. Junio C HamanoNov 9, 2011
  3. Heiko VoigtNov 29, 2011
  4. Leif GruenwoldtDec 10, 2011
  5. Jonathan NiederDec 10, 2011
  6. Junio C HamanoDec 10, 2011
  7. Leif GruenwoldtDec 10, 2011
  8. Andreas T.AuerDec 12, 2011
  9. Leif GruenwoldtDec 12, 2011
  10. Andreas T.AuerDec 12, 2011
  11. Leif GruenwoldtDec 12, 2011
  12. Jens LehmannDec 12, 2011
  13. Phil HordDec 12, 2011
  14. Marc BranchaudDec 13, 2011
  15. Jens LehmannDec 13, 2011
  16. Marc BranchaudDec 13, 2011
  17. Junio C HamanoDec 12, 2011
  18. Phil HordDec 13, 2011
  19. Jens LehmannDec 13, 2011
  20. Phil HordJan 30, 2012
  21. Jens LehmannJan 31, 2012
  22. Phil HordJan 31, 2012
  23. Jens LehmannFeb 1, 2012
  24. Phil HordFeb 6, 2012
  25. Jens LehmannFeb 6, 2012
  26. Brandon CaseyDec 13, 2011
  27. Gioele BarabucciDec 10, 2011

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.