Subject: Re: [PATCH] Detached HEAD (experimental)

From: Andy Parkins <[email-masked]>
Date: Wed, 10 Jan 2007 10:10:44 +0000

On Wednesday 2007 January 10 09:33, Junio C Hamano wrote:

> > If the detached HEAD matches another branch what did we need a detached
> > HEAD for in the first place?
> >
> > Seems that this check will in practice always be true.  A detached HEAD
> > by definition doesn't match some other branch.
>
> You are forgetting this:
>
> 	git checkout v1.0.0

No I'm not.  Linus's suggested check is "git checkout will refuse to switch 
AWAY from a detached head unless the SHA1 of the detached head exactly 
matches some other branch."

My question is what use is that?  In exactly the situation you describe HEAD 
doesn't match a branch.

  git checkout v1.0.0

HEAD after that doesn't match any branch so the next "git checkout" will find 
that HEAD doesn't match any branch and will refuse to switch away.  Why?  A 
checkout in this case isn't dangerous at all.

Of course I could still be misunderstanding.  If Linus meant "refuse to switch 
AWAY from a detached HEAD unless the hash of the detached head exactly 
matches some other ref", I would be less confused.

Andy
-- 
Dr Andy Parkins, M Eng (hons), MIEE
[email-masked]