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

From: Martin Waitz <[email-masked]>
Date: Mon, 21 May 2007 01:36:51 +0200

hoi :)

On Mon, May 21, 2007 at 12:58:10AM +0200, Alex Riesen wrote:
> Martin Waitz, Mon, May 21, 2007 00:14:55 +0200:
> > >  - 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.
> 
> Strange. The very same reason I heard when I tried to explain why
> branches are good. The people found them confusing, just like you now.
> They preach Perforce, too.

Sorry, you lost me.

I didn't say that branches are bad but that guessing branch names based on
their tip is bad.

> > Either use one special branch or detach.
> 
> Why not just detach always?

Which is just another name for "unnamed special branch" ;-)
When you give it a name you can actually use it even after you switched
to another one.

> > >  - 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.
> 
> This is called tree-level merge. Done by -m option (it does more than
> that, yes, but this one too). While at it we can do file-level merge
> as well, why not?

It's not that easy, for submodules we have different levels of dirty:
 * submodule HEAD matches supermodule index, but submodule working
   directory is dirty.
   If the submodule update would touch any modified file then it should
   fail.
   If used with -m (or perhaps another option? after all this merge
   is in a submodule) then it could do the file-level merge for dirty
   files.
 * submodule HEAD does not match supermodule index
   normal checkout should error out if it would touch the submodule.
   checkout -m has to merge submodule HEAD
And of course:
 * index entry of submodule does not match the entry in supermodule HEAD.
   Same as for files.

> > When we have a special managed-by-supermodule branch and the submodule
> > has another branch currently checked out we can entirely ignore this
> > issue.
> 
> Detached head isn't special enough?

it's too special ;-)

-- 
Martin Waitz