From: Shawn O. Pearce Date: Tue, 09 Jan 2007 03:26:40 GMT Subject: Re: [PATCH] Detached HEAD (experimental) Message-ID: <20070109032640.GB1904@spearce.org> In-Reply-To: <87d55pyp82.wl%cworth@cworth.org> Carl Worth wrote: > On Mon, 08 Jan 2007 17:05:26 -0800, Junio C Hamano wrote: > > An obvious alternative is not to allow building on top of a HEAD > > that is detached at all, which I suggested initially. > > I just want to make sure that people that never actually need it don't > have to see the message. And I don't think that _that_ part would be > feasible with the safety valve at the point of "leaving detached > state". It would basically come down to having to do reachability > analysis for the current HEAD from all known branches or something > equally horrific. The common case is probably going to be where the argument to `git checkout` is a fast-foward of the detached HEAD. And that's pretty cheap to check. So we perform that check, and if we fail that then we search through every ref to determine if the detached HEAD is fully contained in any of those. Currently that would be pretty slow to do with the current tools, but a small modification of say git-merge-base (or git-describe) might make it cheap enough to run during this slightly less common case. No need to complicate merge/am/rebase/revert/commit/applymbox with a -b option. -- Shawn.