Re: [PATCH 5/5] builtin/clone: support submodule groups

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

 



Am 25.11.2015 um 19:08 schrieb Stefan Beller:
On Wed, Nov 25, 2015 at 9:52 AM, Jens Lehmann <Jens.Lehmann@xxxxxx> wrote:
+--group::
+       After the clone is created, all submodules which are part of the
+       group are cloned. This option can be given multiple times to
specify
+       different groups.


Ah, that answers my question in my response to the cover letter ;-)

This option will imply automatic submodule
+       updates for the groups by setting `submodule.update=groups`.


Please don't. The per-submodule update setting configures how a
submodule has to be updated, adding a global one with a completely
different meaning (what submodules should be updated?) is confusing.
Why not "submodule.groups=<groups>"?

The documentation is out of date :/ as I was churning through lots of ideas,
so we do have a config submodule.groups=<groups> by now, but the
documentation is wrong.

Thanks for explaining, I did not look at the code very closely so
far so I missed that.


+       The group selection will be passed on recursively, i.e. if a
submodule
+       is cloned because of group membership, its submodules will
+       be cloned according to group membership, too. If a submodule is
+       not cloned however, its submodules are not evaluated for group
+       membership.


What do you mean by the last sentence? Did the clone fail? Then you
cannot update the submodule anyway ...

Consider nested submodules:

     A: superproject containing
         B: which contains
             C.

If you clone A with group <C-but-not-B> you won't get C as we do not traverse
the submodules of B, as we don't clone B. Maybe it's obvious?

Maybe yes. Everything about submodule C is configured in B's
.gitmodules file, not in A's. So you cannot find submodule C
in A's .gitmodules (and it thus cannot be in one of A's submodule
groups either). And if cloning B fails, you have no .gitmodules
file to get the URL of C to clone it from in the first place. So
I think the concept 'group <C-but-not-B>' doesn't make any sense
when C is a submodule of B.

@@ -864,6 +876,21 @@ int cmd_clone(int argc, const char **argv, const char
*prefix)
                 option_no_checkout = 1;
         }

+       if (option_recursive && submodule_groups.nr > 0)
+               die(_("submodule groups and recursive flag are
incompatible"));


Me thinks this contradicts your description of the --group option
in the man page. I don't see why such a restriction would make
sense, what incompatibility are you trying to avoid here? Maybe
we need another submodule-specific setting to tell update what
groups to use inside that submodule?

So you want something like
     "In the top level respect the groups, but recursively get all of them"?

Nope, only those that are chosen by the groups.

My thinking is that groups are implying recursive, whereas recursive implies
"all groups", so a git clone --group <half-the-submodules> --recursive
makes not much sense to me as it begs the question, what does --recursive
mean?

Groups are only about what submodules to update and have nothing to
do with recursion. It might make sense to imply recursion, but that's
just because that should have been the default for submodules from day
one. Recursion and groups are orthogonal, the first is about what to
do inside the submodules (carry on or not?) and the latter is about
what to do in the superproject (shall I update this submodule?).

> Probably recurse into all submodules which are implied by the group
<half-the-submodules>.

Yep. We also do not recurse into those submodules having set their
update setting to "none", so we do not do that for submodules not
in any chosen group either.

> And then get all the nested submodules. But in case
you use the grouping feature, you could just mark the nested submodules with
groups, too?

Not in the top superproject. In a submodule you can specify new groups
for its sub-submodules, but these will in most cases be different from
those of the superproject.

Imagine I have this really cool Metaproject which contains the Android
superproject as a submodule. Those two will define different groups,
and when recursing into the android submodule I need to choose from the
Android specific groups. So my Metaproject's .gitmodules could look like
this:

[submodule "android"]
        path = android
        url = git://...
        groups = default,mobile
        subgroups = devel

"groups" tells git what superproject groups the android submodule
belongs to, and "subgroups" tells git what android submodules are
to be checked out when running recursively into it. If you do not
configure "subgroups", the whole android submodule is updated when
one of the groups "default" or "mobile" is chosen in the superproject.
--
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]