Subject: Re: [RFC] Third round of support for cloning submodules

From: Martin Waitz <[email-masked]>
Date: Mon, 21 May 2007 00:14:55 +0200

hoi :)

On Sun, May 20, 2007 at 12:10:04PM -0700, Junio C Hamano wrote:
> The more important issue I think is at what point in the
> superproject operation does a recursive checkout in a subproject
> should happen, and how we should do the checkout.

we should really move from our big clone thing to a simple
fetch+checkout wrapper.

And then integrate all the submodule logic into the actual checkout
step where it belongs.

We might also want to expand fetch to also fetch newly reachable
submodule commits (of a configurable subset of modules).

> Issues I can think of offhand are (no way exhaustive):
> 
>  - Do we checkout a branch? if so which one?

At least no off-the-shelf branch from the upstream repository of
the submodule.

To use some special branch allows to use normal git methods in
the submodule, too -- but I haven't been able to convince everybody
yet...  So let's get it to a state where people can play with it
in real projects and let's see.

>  - Do we detach HEAD if the commit named by the superproject
>    tree is not at the tip of the current branch of subproject?
>    do we detach always even if the commit is at the tip?

We must not mess with random upstream branches of the submodule
just because they happen to reference the same tip.
That would be too confusing.
Either use one special branch or detach.

>  - What would we do when the subproject working tree is not
>    clean?

The same as with normal files:
error out if something is changed which conflicts with the requested
update.

When we have a special managed-by-supermodule branch and the submodule
has another branch currently checked out we can entirely ignore this
issue.
This really allows the user to deliberately keep one module in an
unclean state.

>  - How can a user decide which subproject to descend into and
>    which subproject to ignore, and how does git remember the
>    earlier decision made by the user without asking the same
>    again, and how does a user express "now I want to also track
>    that subproject I've ignored so far" and "now I am not
>    interested in following that subproject anymore"?

I'd simply use explicit checkout of a submodule and removal of
the submodule to be a fine way to express the user's wish.
Of course we also need some way to say: populate everything
below "src/target" or similar.  But that is independent from
the rest.

-- 
Martin Waitz