Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Martin von Zweigbergk <martinvonz@gmail.com>
Cc: "Jonathan Nieder" <jrnieder@gmail.com>,
	"SZEDER Gábor" <szeder@ira.uka.de>, git <git@vger.kernel.org>
Subject: Re: detached HEAD before root commit - possible?
Date: Sun, 23 Jun 2013 22:01:18 -0700	[thread overview]
Message-ID: <7vbo6wdrvl.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <CANiSa6jNjCDjj_ZD7COXyDUx9DxFpuVqT-Lm24KQVMDK=serpw@mail.gmail.com> (Martin von Zweigbergk's message of "Sun, 23 Jun 2013 21:20:54 -0700")

Martin von Zweigbergk <martinvonz@gmail.com> writes:

> On Sun, Jun 23, 2013 at 4:54 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
>>
>> In other words, HEAD always either points to an unborn or existing
>> branch or an existing commit.  It's not clear to me what it would
>> mean to detach from an unborn branch.
>
> I think it should mean that the next commit would be a root commit (of
> course) and that HEAD would be detached and point to that commit.

Yup.  As Jonathan outlined how the current system works:

 - $GIT_DIR/HEAD could be a symref to a branch, which may or may not
   exist (the latter being "unborn"); or

 - $GIT_DIR/HEAD could be directly pointing at an existing commit,
   which is the definition of "detached", as you "detach HEAD at
   that commit".

even though such a "I do not have any commit and I will not be on
any branch" state were to be supported, the consequence of that
would be that a natural implementation of such a state is to
represent it by not having $GIT_DIR/HEAD at all.  That will break
quite a lot of things, as such a directory $GIT_DIR will not be
treated as a git directory in the first place.  Of course, you could
fix them up to support it, but I doubt if it is worth the trouble.

  reply	other threads:[~2013-06-24  5:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-23 22:55 detached HEAD before root commit - possible? SZEDER Gábor
2013-06-23 23:54 ` Jonathan Nieder
2013-06-24  4:20   ` Martin von Zweigbergk
2013-06-24  5:01     ` Junio C Hamano [this message]
2013-06-24 10:41 ` Matthieu Moy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vbo6wdrvl.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=martinvonz@gmail.com \
    --cc=szeder@ira.uka.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox