Re: [PATCH 6/6] Teach core object handling functions about gitlinks

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Linus Torvalds <torvalds@...>
Cc: Git Mailing List <git@...>, Junio C Hamano <junkio@...>
Date: Wednesday, April 11, 2007 - 4:06 am

hoi :)

thanks Linus for your nice implementation.  Your core code is so much
nicer than my hacked-up prototype :-).

I only had little time to actually have a look at it but the core is
very similiar to my approach and I'll try to rebase some of my code on
top of yours in the following days.

The only thing I disagree with you is in using HEAD of the submodule:

On Mon, Apr 09, 2007 at 09:20:29PM -0700, Linus Torvalds wrote:


h, struct stat *st, int write

Always using HEAD of the submodule makes branches in the submodule
useless.

Whenever you do a checkout in the supermodule you also have to update
the submodule and this update has to change the same thing which is read
above.
Updating the branch which HEAD points to is dangerous.  You could
overwrite some unrelated branch just because the user forgot to switch
back to his supermodule-tracking-branch.  The user would always have to
make sure that all the submodules are in the correct state for an update
of the supermodule.
Updating HEAD directly is possible now and may make some sense, but you
still get problems when you want to switch to some temporary branch in
the submodule.  You have no chance to get back to the original supermodule
version and now your temporary submodule branch gets shown as the new
submodule version which should be part of the supermodule.
The submodule version which is stored in the supermodules tree is kind
of a hidden/remote reference/branch.  When working on a remote branch
we first create a local working branch and then sync it with the remote
one.  I think that it makes sense to use the same model for submodules:
have one local branch in the submodule which is used for all work that
is done in the supermodule context.

So my advice is:
Always read and write one dedicated branch (hardcoded "master" or
configurable) when the supermodule wants to access a submodule.

Then you have two type of branches:
You can branch the supermodule and have you own branch of the entire
project with all submodules.  Use this if you want to commit your
work on the submodule into the supermodule.
You can also branch the submodule to effectively disconnect the
submodule from the supermodule temporarily.  You can use this to
do some experimental/debugging stuff which should not yet go into
the supermodule.  Once you want this branch to show up in the
supermodule, just merge it to "master" and commit it to the supermodule
(and now its in the supermodule branch, the submodule branch is not
needed any more).


See also the discussion about it in the messages around
http://marc.info/?l=3Dgit&m=3D116636334226668&w=3D2

--=20
Martin Waitz
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/6] Initial subproject support (RFC?), Linus Torvalds, (Tue Apr 10, 12:12 am)
Re: [PATCH 0/6] Initial subproject support (RFC?), Linus Torvalds, (Tue Apr 10, 12:46 am)
Re: [PATCH 0/6] Initial subproject support (RFC?), Alex Riesen, (Tue Apr 10, 9:04 am)
Re: [PATCH 0/6] Initial subproject support (RFC?), Martin Waitz, (Wed Apr 11, 4:32 am)
Re: [PATCH 0/6] Initial subproject support (RFC?), Alex Riesen, (Wed Apr 11, 4:42 am)
Re: [PATCH 0/6] Initial subproject support (RFC?), Martin Waitz, (Wed Apr 11, 4:57 am)
Re: [PATCH 0/6] Initial subproject support (RFC?), Linus Torvalds, (Tue Apr 10, 11:13 am)
Re: [PATCH 0/6] Initial subproject support (RFC?), Alex Riesen, (Tue Apr 10, 11:48 am)
Re: [PATCH 0/6] Initial subproject support (RFC?), Linus Torvalds, (Tue Apr 10, 12:07 pm)
Re: [PATCH 0/6] Initial subproject support (RFC?), Junio C Hamano, (Tue Apr 10, 3:32 pm)
Re: [PATCH 0/6] Initial subproject support (RFC?), Linus Torvalds, (Tue Apr 10, 4:11 pm)
Re: [PATCH 0/6] Initial subproject support (RFC?), Junio C Hamano, (Tue Apr 10, 4:52 pm)
Re: [PATCH 0/6] Initial subproject support (RFC?), Sam Ravnborg, (Tue Apr 10, 5:02 pm)
Re: [PATCH 0/6] Initial subproject support (RFC?), Junio C Hamano, (Tue Apr 10, 5:27 pm)
Re: [PATCH 0/6] Initial subproject support (RFC?), Nicolas Pitre, (Tue Apr 10, 5:03 pm)
Re: [PATCH 0/6] Initial subproject support (RFC?), J. Bruce Fields, (Sun Apr 15, 7:21 pm)
Re: [PATCH 0/6] Initial subproject support (RFC?), Alex Riesen, (Tue Apr 10, 12:43 pm)
Re: [PATCH 6/6] Teach core object handling functions about g..., Martin Waitz, (Wed Apr 11, 4:06 am)
Re: [PATCH 6/6] Teach core object handling functions about g..., Josef Weidendorfer, (Thu Apr 12, 11:12 am)
Re: [PATCH 6/6] Teach core object handling functions about g..., Josef Weidendorfer, (Tue Apr 10, 12:28 pm)
Re: [PATCH 6/6] Teach core object handling functions about g..., Josef Weidendorfer, (Tue Apr 10, 3:29 pm)
Re: [PATCH 6/6] Teach core object handling functions about g..., Josef Weidendorfer, (Tue Apr 10, 1:23 pm)
Re: [PATCH 6/6] Teach core object handling functions about g..., Frank Lichtenheld, (Tue Apr 10, 4:40 am)
[PATCH 5/6] Teach "fsck" not to follow subproject links, Linus Torvalds, (Tue Apr 10, 12:15 am)
Re: [PATCH 5/6] Teach "fsck" not to follow subproject links, Junio C Hamano, (Wed Apr 11, 10:00 pm)
Re: [PATCH 5/6] Teach "fsck" not to follow subproject links, Junio C Hamano, (Wed Apr 11, 10:06 pm)
Re: [PATCH 5/6] Teach "fsck" not to follow subproject links, Linus Torvalds, (Wed Apr 11, 10:28 pm)
Re: [PATCH 5/6] Teach "fsck" not to follow subproject links, Linus Torvalds, (Wed Apr 11, 10:14 pm)
Re: [PATCH 5/6] Teach "fsck" not to follow subproject links, Linus Torvalds, (Fri Apr 13, 11:23 am)
Re: [PATCH 5/6] Teach "fsck" not to follow subproject links, Junio C Hamano, (Wed Apr 11, 10:30 pm)
[PATCH 3/6] Add 'resolve_gitlink_ref()' helper function, Linus Torvalds, (Tue Apr 10, 12:14 am)
Re: [PATCH 3/6] Add 'resolve_gitlink_ref()' helper function, Linus Torvalds, (Tue Apr 10, 10:58 am)
Re: [PATCH 3/6] Add 'resolve_gitlink_ref()' helper function, Josef Weidendorfer, (Tue Apr 10, 11:54 am)
Re: [PATCH 3/6] Add 'resolve_gitlink_ref()' helper function, Linus Torvalds, (Tue Apr 10, 11:52 am)
Re: [PATCH 3/6] Add 'resolve_gitlink_ref()' helper function, Linus Torvalds, (Tue Apr 10, 12:16 pm)