Re: [PATCH] Proof-of-concept patch to remember what the detached HEAD was
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 14, 2009, 18:34 UTC
- Message-ID
- <7vljjdese3.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20091014153934.GA3680@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 22 quoted lines
> On Wed, Oct 14, 2009 at 12:33:22PM +0200, Johannes Schindelin wrote:
>
>> > > +char *get_detached_head_string(void)
>> > > +{
>> > > + char *filename = git_path("DETACH_NAME");
>> > > + struct stat st;
>> > > + if (stat(filename, &st) || !S_ISREG(st.st_mode))
>> > > + return NULL;
>> > > + struct strbuf buf = STRBUF_INIT;
>> > > + strbuf_read_file(&buf, filename, st.st_size);
>> > > + strbuf_trim(&buf);
>> > > + return strbuf_detach(&buf, 0);
>> > > +}
>> >
>> > Would it hurt to tuck this information into HEAD itself, as we already
>> > put arbitrary text into FETCH_HEAD?
>>
>> AFAIR we still remember HEAD to be a symlink.
>
> I think that has been abandoned for detached HEAD (that is, if you
> support only symlinked HEAD, then you cannot detach at all). But I might
> be wrong. It has been a while since I looked at that code.If I understand what Daniel is doing correctly, the idea is to keep this extra information only while the HEAD is detached, no? "HEAD itself could be a symlink" is an irrelevant issue, isn't it?