git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git shouldn't allow to push a new branch called HEAD

From
DSDaniele Segato <daniele.bilug@gmail.com>
Date
Nov 14, 2011, 09:07 UTC
Message-ID
<1321261662.2941.13.camel@mastroc3.mobc3.local>
In-Reply-To
<1318592153.2938.21.camel@mastroc3.mobc3.local>
On Fri, 2011-10-14 at 13:35 +0200, Daniele Segato wrote:
Show 70 quoted lines
> On Fri, 2011-10-14 at 13:31 +0200, Daniele Segato wrote:
> > Hi all,
> > 
> > 
> > following from a discussion in IRC freenode #git between me, sitaram an
> > shruggar
> > 
> > 
> > step to reproduce:
> > 
> > $ mkdir /tmp/gitbug
> > $ cd /tmp/gitbug/
> > 
> > $ # create a fake remote repo
> > $ git init --bare remote.git
> > 
> > $ # clone it with the user that will generate the bug
> > $ git clone remote.git buggenerator
> > $ cd buggenerator/
> > $ touch whatever
> > $ git add .
> > $ git commit -m "first commit"
> > $ git push origin master 
> > 
> > $ # now clone the same repo the other guy is the "victim" of this issue
> > $ cd ..
> > $ git clone remote.git victim
> > 
> > $ # time to create the remote HEAD branch
> > $ cd buggenerator/
> > $ git push origin HEAD:HEAD
> > 
> > $ # the remote refs has been created!
> > $ git ls-remote
> > 
> > $ # another commit
> > $ echo 'any change' >> whatever 
> > $ git commit -a -m "some change"
> > $ git push origin master 
> > 
> > $ # the refs/heads/HEAD is still where it was
> > $ git ls-remote
> > 
> > $ # now from the victim perspective
> > $ cd ../victim/
> > 
> > $ # every time executing a fetch he will get a force update
> > $ # or maybe even an error, seen it my real repo, don't know how
> > $ # to reproduce
> > $ git fetch 
> > $ git fetch 
> > $ git ls-remote
> > $ git fetch 
> > $ git ls-remote
> > $ git branch -a
> 
> This should also help understanding what happen in the "victim" local
> repo at every fetch:
> 
> mastro@mastroc3 /tmp/gitbug/victim (master) $ git br -av
> * master                11d0a12 [behind 1] first commit
>   remotes/origin/HEAD   -> origin/master
>   remotes/origin/master 77852ef some change
> mastro@mastroc3 /tmp/gitbug/victim (master) $ git fetch 
> From /tmp/gitbug/remote
>  + 77852ef...11d0a12 HEAD       -> origin/HEAD  (forced update)
> mastro@mastroc3 /tmp/gitbug/victim (master) $ git br -av
> * master                11d0a12 first commit
>   remotes/origin/HEAD   -> origin/master
>   remotes/origin/master 11d0a12 first commit
Hi again,

I'm aware my request has been ignored for a good reason but I would appreciate someone stepping in and explaining to me why this is not a bug or why it has been ignored.

Thanks.

Regards, Daniele Segato

Previous: Daniele SegatoNext: Michael Haggerty
Message 3 of 8 in “Git shouldn't allow to push a new branch called HEAD”
  1. Daniele SegatoOct 14, 2011
  2. Daniele SegatoOct 14, 2011
  3. Daniele SegatoNov 14, 2011
  4. Michael HaggertyNov 14, 2011
  5. Jeff KingNov 14, 2011
  6. Junio C HamanoNov 14, 2011
  7. Jeff KingNov 14, 2011
  8. P RouleauOct 14, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.