Thread (3 messages) flat view 3 messages, 3 authors, 2016-06-15

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

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2016-06-15 22:43:04


On Thu, 12 Apr 2007, Martin Waitz wrote:
But why does everybody want to detach the submodule HEAD, instead
of creating one 'special' branch which holds the commit which is
used by the supermodule?
I don't think "everybody" wants it.

But the point is, *regardless* of whether you want a "detached HEAD" or 
you want a "'special' branch", you should always use HEAD to look up the 
commit, and using HEAD *allows* both (ie just make HEAD a symref to the 
'special' branch if you want that behaviour).

And if you *do* use a special branch, HEAD *must* match that special 
branch anyway, since when you commit in the supermodule, the only 
behaviour that makes sense is to commit the currently checked out state!
I want to create the extra branch exactly _because_ there is
independent work going on in the submodule (or the project it is
based on).
And that is entirely appropriate.

But that still means that HEAD must point to that branch (when in the 
submodule), since that branch must be the one that is checked out. If it 
isn't the branch that is checked out, normal operations like "git diff" 
etc wouldn't make sense from the supermodule.

And that is why *regardless* of whether you use a special branch or not, 
HEAD is the right thing to look up.

		Linus
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help