{"thread":{"id":"29566","subject":"cloning a tree which has detached branch checked out","startedAt":"2012-02-07T07:06:29Z","lastAt":"2012-02-08T10:17:30Z","messageCount":10,"participants":["Michael S. Tsirkin","Jakub Narebski","Nguyen Thai Ngoc Duy","Jeff King","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"184103","messageId":"20120207070628.GA24698@redhat.com","threadId":"29566","inReplyTo":null,"subject":"cloning a tree which has detached branch checked out","fromName":"Michael S. Tsirkin","fromEmail":"mst@redhat.com","sentAt":"2012-02-07T07:06:29Z","receivedAt":"2012-02-07T07:06:29Z","isPatch":false,"sender":{"key":"mst@kernel.org","avatar":null},"body":"I have a tree where I checked out a remote, without\ncreating a local branch, this detaches the HEAD:\n# git branch\n* (no branch)\n  master\n#git log|head -1\ncommit cec64082f689f949a397cb9b39423dc41545fa0e\n#git log master..HEAD|head -1\ncommit cec64082f689f949a397cb9b39423dc41545fa0e\n\n\nNow if I try to clone it:\n#git clone -n lab:/home/mst/scm/linux\nInitialized empty Git repository in /home/mst/scm/linux/.git/\nremote: Counting objects: 1693446, done.\nremote: Compressing objects: 100% (277054/277054), done.\nReceiving objects: 100% (1693446/1693446), 418.16 MiB | 7.63 MiB/s,\ndone.\nremote: Total 1693446 (delta 1414353), reused 1681280 (delta 1402358)\nResolving deltas: 100% (1414353/1414353), done.\nerror: Trying to write ref HEAD with nonexistant object\ncec64082f689f949a397cb9b39423dc41545fa0e\nfatal: Cannot update the ref 'HEAD'.\n\nLooks like a bug, doesn't it?\n\n-- \nMST\n"},{"id":"184115","messageId":"m362fjklb7.fsf@localhost.localdomain","threadId":"29566","inReplyTo":"20120207070628.GA24698@redhat.com","subject":"Re: cloning a tree which has detached branch checked out","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2012-02-07T10:08:33Z","receivedAt":"2012-02-07T10:08:33Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"\"Michael S. Tsirkin\" <mst@redhat.com> writes:\n\n> I have a tree where I checked out a remote, without\n> creating a local branch, this detaches the HEAD:\n> # git branch\n> * (no branch)\n>   master\n> #git log|head -1\n> commit cec64082f689f949a397cb9b39423dc41545fa0e\n> #git log master..HEAD|head -1\n> commit cec64082f689f949a397cb9b39423dc41545fa0e\n> \n> \n> Now if I try to clone it:\n> #git clone -n lab:/home/mst/scm/linux\n> Initialized empty Git repository in /home/mst/scm/linux/.git/\n> remote: Counting objects: 1693446, done.\n> remote: Compressing objects: 100% (277054/277054), done.\n> Receiving objects: 100% (1693446/1693446), 418.16 MiB | 7.63 MiB/s,\n> done.\n> remote: Total 1693446 (delta 1414353), reused 1681280 (delta 1402358)\n> Resolving deltas: 100% (1414353/1414353), done.\n> error: Trying to write ref HEAD with nonexistant object\n> cec64082f689f949a397cb9b39423dc41545fa0e\n> fatal: Cannot update the ref 'HEAD'.\n> \n> Looks like a bug, doesn't it?\n\nWhich git version?  IIRC there was some bugfix recently in that\narea...\n\n-- \nJakub Narebski\n"},{"id":"184116","messageId":"20120207104100.GA24828@redhat.com","threadId":"29566","inReplyTo":"m362fjklb7.fsf@localhost.localdomain","subject":"Re: cloning a tree which has detached branch checked out","fromName":"Michael S. Tsirkin","fromEmail":"mst@redhat.com","sentAt":"2012-02-07T10:41:00Z","receivedAt":"2012-02-07T10:41:00Z","isPatch":false,"sender":{"key":"mst@kernel.org","avatar":null},"body":"On Tue, Feb 07, 2012 at 02:08:33AM -0800, Jakub Narebski wrote:\n> \"Michael S. Tsirkin\" <mst@redhat.com> writes:\n> \n> > I have a tree where I checked out a remote, without\n> > creating a local branch, this detaches the HEAD:\n> > # git branch\n> > * (no branch)\n> >   master\n> > #git log|head -1\n> > commit cec64082f689f949a397cb9b39423dc41545fa0e\n> > #git log master..HEAD|head -1\n> > commit cec64082f689f949a397cb9b39423dc41545fa0e\n> > \n> > \n> > Now if I try to clone it:\n> > #git clone -n lab:/home/mst/scm/linux\n> > Initialized empty Git repository in /home/mst/scm/linux/.git/\n> > remote: Counting objects: 1693446, done.\n> > remote: Compressing objects: 100% (277054/277054), done.\n> > Receiving objects: 100% (1693446/1693446), 418.16 MiB | 7.63 MiB/s,\n> > done.\n> > remote: Total 1693446 (delta 1414353), reused 1681280 (delta 1402358)\n> > Resolving deltas: 100% (1414353/1414353), done.\n> > error: Trying to write ref HEAD with nonexistant object\n> > cec64082f689f949a397cb9b39423dc41545fa0e\n> > fatal: Cannot update the ref 'HEAD'.\n> > \n> > Looks like a bug, doesn't it?\n> \n> Which git version?  IIRC there was some bugfix recently in that\n> area...\n\nSorry, forgot to mention that. It's pretty recent:\n$ git --version\ngit version 1.7.9.111.gf3fb0\n\n\n> -- \n> Jakub Narebski\n"},{"id":"184126","messageId":"CACsJy8DtmQLX+Lfng-QRzVg9sfo8gQMXB-xTtPYpt+R2gModTg@mail.gmail.com","threadId":"29566","inReplyTo":"20120207104100.GA24828@redhat.com","subject":"Re: cloning a tree which has detached branch checked out","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2012-02-07T12:57:08Z","receivedAt":"2012-02-07T12:57:08Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Tue, Feb 7, 2012 at 5:41 PM, Michael S. Tsirkin <mst@redhat.com> wrote:\n>> > #git clone -n lab:/home/mst/scm/linux\n>> > ....\n>> > error: Trying to write ref HEAD with nonexistant object\n>> > cec64082f689f949a397cb9b39423dc41545fa0e\n>> > fatal: Cannot update the ref 'HEAD'.\n>> >\n>> > Looks like a bug, doesn't it?\n>>\n>> Which git version?  IIRC there was some bugfix recently in that\n>> area...\n>\n> Sorry, forgot to mention that. It's pretty recent:\n> $ git --version\n> git version 1.7.9.111.gf3fb0\n\nThe series that Jakub mentioned is probably nd/clone-detached 5ce2b97,\nwhich is already included in your tree. Does 1.7.9 work?\n\nI tried but it was ok for me. I think ref processing at local probably\ngoes wrong and does not request commit from HEAD.  If the repo is not\nconfidential, you can zip it and send me.\n-- \nDuy\n"},{"id":"184127","messageId":"20120207130204.GA7600@redhat.com","threadId":"29566","inReplyTo":"CACsJy8DtmQLX+Lfng-QRzVg9sfo8gQMXB-xTtPYpt+R2gModTg@mail.gmail.com","subject":"Re: cloning a tree which has detached branch checked out","fromName":"Michael S. Tsirkin","fromEmail":"mst@redhat.com","sentAt":"2012-02-07T13:02:05Z","receivedAt":"2012-02-07T13:02:05Z","isPatch":false,"sender":{"key":"mst@kernel.org","avatar":null},"body":"On Tue, Feb 07, 2012 at 07:57:08PM +0700, Nguyen Thai Ngoc Duy wrote:\n> On Tue, Feb 7, 2012 at 5:41 PM, Michael S. Tsirkin <mst@redhat.com> wrote:\n> >> > #git clone -n lab:/home/mst/scm/linux\n> >> > ....\n> >> > error: Trying to write ref HEAD with nonexistant object\n> >> > cec64082f689f949a397cb9b39423dc41545fa0e\n> >> > fatal: Cannot update the ref 'HEAD'.\n> >> >\n> >> > Looks like a bug, doesn't it?\n> >>\n> >> Which git version?  IIRC there was some bugfix recently in that\n> >> area...\n> >\n> > Sorry, forgot to mention that. It's pretty recent:\n> > $ git --version\n> > git version 1.7.9.111.gf3fb0\n> \n> The series that Jakub mentioned is probably nd/clone-detached 5ce2b97,\n> which is already included in your tree. Does 1.7.9 work?\n\nI'll try that.\n\n> I tried but it was ok for me. I think ref processing at local probably\n> goes wrong and does not request commit from HEAD.  If the repo is not\n> confidential, you can zip it and send me.\n\nCan't unfortunately :(\nWould some verbose logs help?\n\n> -- \n> Duy\n"},{"id":"184128","messageId":"CACsJy8ArYYjX2VqPbpg7qU8ZbK0m_Cm-cQ35_ZZahrYAZJ7pow@mail.gmail.com","threadId":"29566","inReplyTo":"20120207130204.GA7600@redhat.com","subject":"Re: cloning a tree which has detached branch checked out","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2012-02-07T13:07:12Z","receivedAt":"2012-02-07T13:07:12Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Tue, Feb 7, 2012 at 8:02 PM, Michael S. Tsirkin <mst@redhat.com> wrote:\n>> I tried but it was ok for me. I think ref processing at local probably\n>> goes wrong and does not request commit from HEAD.  If the repo is not\n>> confidential, you can zip it and send me.\n>\n> Can't unfortunately :(\n> Would some verbose logs help?\n\nYou can try cloning with GIT_TRACE_PACKET=1. bisect should also help.\n-- \nDuy\n"},{"id":"184133","messageId":"20120207153225.GA14773@sigill.intra.peff.net","threadId":"29566","inReplyTo":"CACsJy8DtmQLX+Lfng-QRzVg9sfo8gQMXB-xTtPYpt+R2gModTg@mail.gmail.com","subject":"Re: cloning a tree which has detached branch checked out","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-02-07T15:32:25Z","receivedAt":"2012-02-07T15:32:25Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Feb 07, 2012 at 07:57:08PM +0700, Nguyen Thai Ngoc Duy wrote:\n\n> On Tue, Feb 7, 2012 at 5:41 PM, Michael S. Tsirkin <mst@redhat.com> wrote:\n> >> > #git clone -n lab:/home/mst/scm/linux\n> >> > ....\n> >> > error: Trying to write ref HEAD with nonexistant object\n> >> > cec64082f689f949a397cb9b39423dc41545fa0e\n> >> > fatal: Cannot update the ref 'HEAD'.\n> >> >\n> >> > Looks like a bug, doesn't it?\n> >>\n> >> Which git version?  IIRC there was some bugfix recently in that\n> >> area...\n> >\n> > Sorry, forgot to mention that. It's pretty recent:\n> > $ git --version\n> > git version 1.7.9.111.gf3fb0\n> \n> The series that Jakub mentioned is probably nd/clone-detached 5ce2b97,\n> which is already included in your tree. Does 1.7.9 work?\n> \n> I tried but it was ok for me. I think ref processing at local probably\n> goes wrong and does not request commit from HEAD.  If the repo is not\n> confidential, you can zip it and send me.\n\nThis particular bug should have been fixed before that, even, with my\nc1921c1 (clone: always fetch remote HEAD, 2011-06-07). And it is tested\nexplicitly in t5707, so your series does not regress at least a simple\ncase. So I think your guess about a subtle error in the local ref\nprocessing is a reasonable one.\n\n-Peff\n"},{"id":"184139","messageId":"7v4nv236xn.fsf@alter.siamese.dyndns.org","threadId":"29566","inReplyTo":"20120207153225.GA14773@sigill.intra.peff.net","subject":"Re: cloning a tree which has detached branch checked out","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-07T17:11:00Z","receivedAt":"2012-02-07T17:11:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Tue, Feb 07, 2012 at 07:57:08PM +0700, Nguyen Thai Ngoc Duy wrote:\n>\n>> On Tue, Feb 7, 2012 at 5:41 PM, Michael S. Tsirkin <mst@redhat.com> wrote:\n>> >> > #git clone -n lab:/home/mst/scm/linux\n>> >> > ....\n>> >> > error: Trying to write ref HEAD with nonexistant object\n>> >> > cec64082f689f949a397cb9b39423dc41545fa0e\n>> >> > fatal: Cannot update the ref 'HEAD'.\n>> >> >\n>> >> > Looks like a bug, doesn't it?\n>> >> ...\n>\n> This particular bug should have been fixed before that, even, with my\n> c1921c1 (clone: always fetch remote HEAD, 2011-06-07). And it is tested\n> explicitly in t5707,...\n\nThat was my thought when I first saw it.  The failure case was that HEAD\nwas pointing at something no ref reaches, and clone was only grabbing the\ntips of branches, which failed to transfer the history leading to HEAD.\n\n> ... So I think your guess about a subtle error in the local ref\n> processing is a reasonable one.\n\nWhat is funny is \"error: Trying to write ref HEAD with nonexistant object\".\n\"git grep -e nonexistant f3fb0\" does not register any hit.\n\nCould it be that mysterious \"lab:\" protocol handler that is misbehaving?\n"},{"id":"184140","messageId":"20120207171604.GA26614@sigill.intra.peff.net","threadId":"29566","inReplyTo":"7v4nv236xn.fsf@alter.siamese.dyndns.org","subject":"Re: cloning a tree which has detached branch checked out","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-02-07T17:16:04Z","receivedAt":"2012-02-07T17:16:04Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Feb 07, 2012 at 09:11:00AM -0800, Junio C Hamano wrote:\n\n> > This particular bug should have been fixed before that, even, with my\n> > c1921c1 (clone: always fetch remote HEAD, 2011-06-07). And it is tested\n> > explicitly in t5707,...\n> [...]\n> What is funny is \"error: Trying to write ref HEAD with nonexistant object\".\n> \"git grep -e nonexistant f3fb0\" does not register any hit.\n\nThat misspelling of \"nonexistent\" was fixed by 7be8b3b (Fix typo:\nexistant->existent, 2011-06-16), around the same time as my clone patch.\nWhich really makes me wonder if the OP is accidentally running an old\nversion of git during the tests.\n\n> >> On Tue, Feb 7, 2012 at 5:41 PM, Michael S. Tsirkin <mst@redhat.com> wrote:\n> >> >> > #git clone -n lab:/home/mst/scm/linux\n> [...]\n> Could it be that mysterious \"lab:\" protocol handler that is misbehaving?\n\nI think you are misreading. It would be \"lab::\" in that case, no? The\ncommand above should do ssh transport to the machine \"lab\".\n\n-Peff\n"},{"id":"184182","messageId":"20120208101729.GA26551@redhat.com","threadId":"29566","inReplyTo":"20120207171604.GA26614@sigill.intra.peff.net","subject":"Re: cloning a tree which has detached branch checked out","fromName":"Michael S. Tsirkin","fromEmail":"mst@redhat.com","sentAt":"2012-02-08T10:17:30Z","receivedAt":"2012-02-08T10:17:30Z","isPatch":false,"sender":{"key":"mst@kernel.org","avatar":null},"body":"On Tue, Feb 07, 2012 at 12:16:04PM -0500, Jeff King wrote:\n> On Tue, Feb 07, 2012 at 09:11:00AM -0800, Junio C Hamano wrote:\n> \n> > > This particular bug should have been fixed before that, even, with my\n> > > c1921c1 (clone: always fetch remote HEAD, 2011-06-07). And it is tested\n> > > explicitly in t5707,...\n> > [...]\n> > What is funny is \"error: Trying to write ref HEAD with nonexistant object\".\n> > \"git grep -e nonexistant f3fb0\" does not register any hit.\n> \n> That misspelling of \"nonexistent\" was fixed by 7be8b3b (Fix typo:\n> existant->existent, 2011-06-16), around the same time as my clone patch.\n> Which really makes me wonder if the OP is accidentally running an old\n> version of git during the tests.\n\nDouble checked and you are right: the box actually runs git 1.7.1.\nRechecked with 1.7.9.GIT and it behaves correctly.\n\nMy mistake, sorry about the noise.\n\n-- \nMST\n"}]}