Re: [PATCH/RFC] Changing submodule foreach --recursive to be depth-first, --parent option to execute command in supermodule as well

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jens Lehmann <Jens.Lehmann@xxxxxx> writes:

> Am 12.03.2013 17:01, schrieb Phil Hord:
>> On Sat, Mar 9, 2013 at 1:18 PM, Jens Lehmann <Jens.Lehmann@xxxxxx> wrote:
>>> Am 05.03.2013 22:17, schrieb Phil Hord:
>>>> On Tue, Mar 5, 2013 at 3:51 PM, Jens Lehmann <Jens.Lehmann@xxxxxx> wrote:
>>>>> Am 05.03.2013 19:34, schrieb Junio C Hamano:
>>>>>> Eric Cousineau <eacousineau@xxxxxxxxx> 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.

FWIW, after thinking about it a bit more and especially after
thinking about the nested submodule layout, I changed my mind.

The reasoning is very simple.  In short, your "top-level" may be
somebody else's submodule.

If you have a project A, that has a submodule B & C that in turn
have submodules D, E & F, G, like this:

	        A
               / \
              B   C
             / \ / \
            D  E F  G

you may want your "submodule foreach [--post-order]" that is run at
the top-level to visit B D E C F G (or D E B F G C).  A is not a
submodule, and it may be rational to do without --also-toplevel
option from the point of view of yourself.

But if "submodule foreach [--post-order] B" run at the top-level
visits B D E (or D E B), wouldn't it be more natural if you had a
way to optionally make this

	cd B && submodule foreach [--post-order]

visit the same modules in the same way?  The story is the same if
your top-level project A is bound at a path in somebody else's
project as a submodule.  His "submodulle foreach" will visit your
top-level A while visiting the hierarchy of your submodules (and
other submodules he has as your siblings).

I do not know if foreach should visit your top-level by default;
changing that may be too late and too disruptive.  But I think an
optional "I want this traversal to also visit the top" would not be
so _wrong_ even at the conceptual level.

Of course, it may make the implementation simpler, too ;-)  foreach
could just scan the immediate submodules, chdir into each of them
and then run the equivalent foreach with --also-toplevel option,
with the same --post-order (or --pre-order) option.


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]