Subject: Re: [Non-Bug] cloning a repository with a default MASTER branch tries to check out the master branch

From: Junio C Hamano <[email-masked]>
Date: Sun, 28 May 2017 08:55:01 +0900

"Philip Oakley" <[email-masked]> writes:

> However given the discussion about an unborn HEAD, the option here
> would be to also pass the NULL sha for the symref and then add the
> annotation 'HEAD' after an extra \0, in the same way that an active
> symref could be annotated with the '\0HEAD'. This would kill two birds
> with one stone!

Are you aware of the symref capability that is already advertised in
the initial upload-pack response?  Right now, we do so only when
HEAD actually points at something, and the earlier suggestion by
Peff is to do so unconditionally, even when HEAD is dangling.

Existing clients that are symref aware do not do anything (good or
bad) when a HEAD that is dangling [*1*] is advertised, so such a
change will not hurt (but it would not help by itself either).
Ancient clients that are not even aware of the symref are not
affected.

Then new clients _could_ start paying attention to the advertised
HEAD that is dangling.

The bundle transport is a different beast.  I do not think it
advertises where HEAD is pointing at, whether it is dangling or
not.

[Footnote]

*1* A HEAD symref that is advertised in the upload-pack response is
    dangling when its pointee does not appear in the set of refs
    that are advertised.  Félix's case would have shown HEAD
    pointing at refs/heads/master in the symref capability extension,
    but the list of refs and their values would not have included
    that ref (there was only refs/heads/MASTER "for joke reasons").