Re: [PATCH/RFC] Changing submodule foreach --recursive to be depth-first, --parent option to execute command in supermodule as well
- From
Phil Hord <phil.hord@gmail.com>
- Date
- Mar 5, 2013, 21:17 UTC
- Message-ID
- <CABURp0psgofX=ean+KKooN74pF4Ns-gDGt68vc5Exs6NmDRUyw@mail.gmail.com>
- In-Reply-To
- <51365AB6.2010602@web.de>
On Tue, Mar 5, 2013 at 3:51 PM, Jens Lehmann <Jens.Lehmann@web.de> wrote:
Show 15 quoted lines
> Am 05.03.2013 19:34, schrieb Junio C Hamano: >> Eric Cousineau <eacousineau@gmail.com> writes: >>> ... >> I am not entirely convinced we would want --include-super in the >> first place, though. It does not belong to "submodule foreach"; >> it is doing something _outside_ the submoudules. > > I totally agree with that. First, adding --include-super does not > belong into the --post-order patch at all, as that is a different > topic (even though it belongs to the same use case Eric has). Also > the reason why we are thinking about adding the --post-order option > IMO cuts the other way for --include-super: It is so easy to do > that yourself I'm not convinced we should add an extra option to > foreach for that, especially as it has nothing to do with submodules. > So I think we should just drop --include-super.
I agree it should not be part of this commit, but I've often found myself in need of an --include-super switch. To me, git-submodule-foreach means "visit all my .git repos in this project and execute $cmd". It's a pity that the super-project is considered a second-class citizen in this regard.
I have to do this sometimes:
${cmd} && git submodule foreach --recursive '${cmd}'I often forget the first part in scripts, though, and I've seen others do it too. I usually create a function for it in git-heavy scripts.
In a shell, it usually goes like this:
git submodule foreach --recursive '${cmd}'
<up><home><del>{30-ish}<end><backspace><enter>It'd be easier if I could just include a switch for this, and maybe even create an alias for it. But maybe this is different command altogether.