Subject: Re: Pushing symbolic references to remote repositories?

From: Andreas Schwab <[email-masked]>
Date: Sat, 22 Dec 2012 10:26:32 +0100

Junio C Hamano <[email-masked]> writes:

> I think that the only one and a half sensible use cases that
> unconditionally make sense to update symrefs across repositories are
> to update bare.git/HEAD symref:
>
>  - update bare.git/HEAD of a repository that is a local mirror of a
>    more authoritative repository with "git fetch --mirror", in which
>    case you do want to follow what branch is designated as the
>    primary by the project you are mirroring from;
>
>  - update bare.git/HEAD from outside by some means to change which
>    branch is the primary one for the project. Only because your
>    hosting site does not give you an easy way to do so, pushing from
>    another repository that happens to point its HEAD at a different
>    branch seems to be one plausible way to do so, but that does not
>    have to be the only way.

This is not limited to HEAD, any ref may want to be set up as a symref
at a remote repo.  For example, I want to set up a symref master ->
trunk at a repository I have no shell access to.  Without this I get
spurious error whenever I fetch from that remote (where master and trunk
are separate refs) into a local mirror which does have the symref:

>>From git://repo.or.cz/emacs
   f0ae89f..5595931  master     -> master
error: Ref refs/heads/trunk is at 559593152b9de5a1c144729e0583fa7968abab22 but expected f0ae89f92326beb3f5a19e90c8f4fe0ab6197926
 ! f0ae89f..5595931  trunk      -> trunk  (unable to update local ref)

Andreas.

-- 
Andreas Schwab, [email-masked]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."