{"thread":{"id":"2851","subject":"Now what: multiple HEAD refs","startedAt":"2005-12-15T09:05:51Z","lastAt":"2005-12-15T15:57:02Z","messageCount":9,"participants":["Alex Riesen","Junio C Hamano","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"13679","messageId":"81b0412b0512150105p5bacd6a1j938824ae2ab96858@mail.gmail.com","threadId":"2851","inReplyTo":null,"subject":"Now what: multiple HEAD refs","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2005-12-15T09:05:51Z","receivedAt":"2005-12-15T09:05:51Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Hi,\n\njust a heads-up for everyone tried \"git pull\" after using \"git merge\" too much:\n\n$ git pull . ref1 HEAD (notice the space!)\n\nwill happily create refs/heads/HEAD. What happens next is not easily\nto understand: all files suddenly declared \"New\" by \"git status\", \"git\ncheckout\" does not work, reporting \"Need a single revision\" (which is\nactually _the_ hint here).\n\nThe solution is simple: remove .git/refs/heads/HEAD\n\nMaybe \"git fsck-object\" can hint on multiple HEADS?\n"},{"id":"13680","messageId":"7v8xumr9mw.fsf@assigned-by-dhcp.cox.net","threadId":"2851","inReplyTo":"81b0412b0512150105p5bacd6a1j938824ae2ab96858@mail.gmail.com","subject":"Re: Now what: multiple HEAD refs","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-12-15T09:29:27Z","receivedAt":"2005-12-15T09:29:27Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alex Riesen <raa.lkml@gmail.com> writes:\n\n> just a heads-up for everyone tried \"git pull\" after using \"git merge\" too much:\n>\n> $ git pull . ref1 HEAD (notice the space!)\n\nIf you were too used to git merge, you would have wrote\nHEAD before ref1, so that does not sound plausible ;-).\n\n        $ git pull . maint HEAD\n        error: no such remote ref refs/heads/HEAD\n        Fetch failure: .\n\t$ echo $?\n        1\n\nBut worse yet, the above syntax is to create an Octopus, and you\nprobably did not mean that.\n\nI think the reason why my trial here worked correctly while you\nhad trouble with it is because I have the send-pack fix from\nPasky last night.\n"},{"id":"13681","messageId":"81b0412b0512150216w295a5943ma66522befe381529@mail.gmail.com","threadId":"2851","inReplyTo":"7v8xumr9mw.fsf@assigned-by-dhcp.cox.net","subject":"Re: Now what: multiple HEAD refs","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2005-12-15T10:16:26Z","receivedAt":"2005-12-15T10:16:26Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 12/15/05, Junio C Hamano <junkio@cox.net> wrote:\n> > just a heads-up for everyone tried \"git pull\" after using \"git merge\" too much:\n> >\n> > $ git pull . ref1 HEAD (notice the space!)\n>\n> If you were too used to git merge, you would have wrote\n> HEAD before ref1, so that does not sound plausible ;-).\n\nno, that I have remembered. What I constantly forget is the\nspace-vs-colon difference.\n\n>         $ git pull . maint HEAD\n>         error: no such remote ref refs/heads/HEAD\n>         Fetch failure: .\n>         $ echo $?\n>         1\n>\n> But worse yet, the above syntax is to create an Octopus, and you\n> probably did not mean that.\n\nno, of course not.\n\n> I think the reason why my trial here worked correctly while you\n> had trouble with it is because I have the send-pack fix from\n> Pasky last night.\n\nyes, probably. It cleanups a reference if there was an error, right?\n"},{"id":"13683","messageId":"7vu0daphmf.fsf@assigned-by-dhcp.cox.net","threadId":"2851","inReplyTo":"81b0412b0512150216w295a5943ma66522befe381529@mail.gmail.com","subject":"Re: Now what: multiple HEAD refs","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-12-15T14:19:52Z","receivedAt":"2005-12-15T14:19:52Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alex Riesen <raa.lkml@gmail.com> writes:\n\n> On 12/15/05, Junio C Hamano <junkio@cox.net> wrote:\n>> I think the reason why my trial here worked correctly while you\n>> had trouble with it is because I have the send-pack fix from\n>> Pasky last night.\n>\n> yes, probably. It cleanups a reference if there was an error, right?\n\nNot really.  send-pack does not have anything to do with this\n(it is involved in git-push not git-pull).  Care to see how\nyours gets broken when you do \"sh -x git-pull.sh . ref1 HEAD\"?\nIf .git/refs/heads/HEAD exists in the first place then I would\nunderstand it would not fail with the error message I quoted,\nbut the original message from you indicated that \"git pull\" is\nthe one that creates the breakage, and I am trying to see how.\n"},{"id":"13684","messageId":"7vlkymph4f.fsf@assigned-by-dhcp.cox.net","threadId":"2851","inReplyTo":"81b0412b0512150216w295a5943ma66522befe381529@mail.gmail.com","subject":"Re: Now what: multiple HEAD refs","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-12-15T14:30:40Z","receivedAt":"2005-12-15T14:30:40Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alex Riesen <raa.lkml@gmail.com> writes:\n\n> On 12/15/05, Junio C Hamano <junkio@cox.net> wrote:\n>\n>> >\n>> > $ git pull . ref1 HEAD (notice the space!)\n>>\n>> If you were too used to git merge, you would have wrote\n>> HEAD before ref1, so that does not sound plausible ;-).\n>\n> no, that I have remembered. What I constantly forget is the\n> space-vs-colon difference.\n\nThat statement sounds as if \"git pull . ref1:HEAD\" makes some\nsense and you typed it without colon by mistake.  But it does\nnot make any sense to me; I am puzzled ... what are you trying\nto achieve with \"git pull . ref1:HEAD\"?\n\nThe patch from Johannes feels right but I haven't had caffeine\nyet, so..\n"},{"id":"13685","messageId":"81b0412b0512150654o49e1edacu67b88df6347736d2@mail.gmail.com","threadId":"2851","inReplyTo":"7vlkymph4f.fsf@assigned-by-dhcp.cox.net","subject":"Re: Now what: multiple HEAD refs","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2005-12-15T14:54:27Z","receivedAt":"2005-12-15T14:54:27Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 12/15/05, Junio C Hamano <junkio@cox.net> wrote:\n> >> >\n> >> > $ git pull . ref1 HEAD (notice the space!)\n> >>\n> >> If you were too used to git merge, you would have wrote\n> >> HEAD before ref1, so that does not sound plausible ;-).\n> >\n> > no, that I have remembered. What I constantly forget is the\n> > space-vs-colon difference.\n>\n> That statement sounds as if \"git pull . ref1:HEAD\" makes some\n> sense and you typed it without colon by mistake.  But it does\n\nexactly.\n\n> not make any sense to me; I am puzzled ... what are you trying\n> to achieve with \"git pull . ref1:HEAD\"?\n\nmerge branch ref1 into current. Is that not a correct refspec?\n"},{"id":"13687","messageId":"81b0412b0512150714t293c29fav6cddc1c74ee4a6b3@mail.gmail.com","threadId":"2851","inReplyTo":"7vu0daphmf.fsf@assigned-by-dhcp.cox.net","subject":"Re: Now what: multiple HEAD refs","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2005-12-15T15:14:59Z","receivedAt":"2005-12-15T15:14:59Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 12/15/05, Junio C Hamano <junkio@cox.net> wrote:\n> >> I think the reason why my trial here worked correctly while you\n> >> had trouble with it is because I have the send-pack fix from\n> >> Pasky last night.\n> >\n> > yes, probably. It cleanups a reference if there was an error, right?\n>\n> Not really.  send-pack does not have anything to do with this\n> (it is involved in git-push not git-pull).  Care to see how\n> yours gets broken when you do \"sh -x git-pull.sh . ref1 HEAD\"?\n\nI tried. Interesting: no refs/heads/HEAD. But, then I tried \"ref1:HEAD\":\n\nbroken-HEAD /d/download/git2 [822]\nPATH=\".:$PATH\" sh -x git-pull . lf-usage:HEAD\n+ . git-sh-setup\n++ unset CDPATH\n++ : .git\n++ : .git/objects\n++ GIT_DIR=.git\n++ git-var GIT_AUTHOR_IDENT\n+ strategy_args=\n+ no_summary=\n+ no_commit=\n+ break\n++ git-rev-parse --verify HEAD\n+ orig_head=5a0b59da20d832fcfdf864b522718acbc2171525\n+ git-fetch --update-head-ok . lf-usage:HEAD\n* refs/heads/HEAD: storing branch 'lf-usage' of .\n++ git-rev-parse --verify HEAD\ngit-rev-parse: fatal: Needed a single revision\n+ curr_head=\n+ test '' '!=' 5a0b59da20d832fcfdf864b522718acbc2171525\n+ echo 'Warning: fetch updated the current branch head.'\nWarning: fetch updated the current branch head.\n+ echo 'Warning: fast forwarding your working tree.'\nWarning: fast forwarding your working tree.\n+ git-read-tree -u -m 5a0b59da20d832fcfdf864b522718acbc2171525 ''\nusage: git-read-tree (<sha> | -m [-u | -i] <sha1> [<sha2> [<sha3>]])\n+ die 'You need to first update your working tree.'\n+ echo 'You need to first update your working tree.'\nYou need to first update your working tree.\n+ exit 1\n\nAnd of course, there was refs/heads/HEAD now.\nSo it seems that I _had_ typed it with a colon (though I'm very sure I\ndid it with a space as well). Sorry for the whole confusion, but that\nreveals that other problem, which Johannes' patch partially helps\nwith.\n"},{"id":"13689","messageId":"Pine.LNX.4.63.0512151638260.3104@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2851","inReplyTo":"81b0412b0512150654o49e1edacu67b88df6347736d2@mail.gmail.com","subject":"Re: Now what: multiple HEAD refs","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-12-15T15:40:27Z","receivedAt":"2005-12-15T15:40:27Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 15 Dec 2005, Alex Riesen wrote:\n\n> > not make any sense to me; I am puzzled ... what are you trying\n> > to achieve with \"git pull . ref1:HEAD\"?\n> \n> merge branch ref1 into current. Is that not a correct refspec?\n\nNo, it is not correct. To pull means that you want to merge the fetched \nref (your ref1), and store the result in the current branch.\n\nBut if you write \"ref1:HEAD\", you pretend that you want to fast-forward \nthe local branch \"HEAD\" to ref1, and get an error if it is not \nforwardable.\n\nIn your case, I guess, \"git pull ref1\" is what you meant.\n\nHth,\nDscho\n"},{"id":"13690","messageId":"81b0412b0512150757v3acf1bdfudbe9ff26b544b196@mail.gmail.com","threadId":"2851","inReplyTo":"Pine.LNX.4.63.0512151638260.3104@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: Now what: multiple HEAD refs","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2005-12-15T15:57:02Z","receivedAt":"2005-12-15T15:57:02Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 12/15/05, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> > > not make any sense to me; I am puzzled ... what are you trying\n> > > to achieve with \"git pull . ref1:HEAD\"?\n> >\n> > merge branch ref1 into current. Is that not a correct refspec?\n>\n> No, it is not correct. To pull means that you want to merge the fetched\n> ref (your ref1), and store the result in the current branch.\n>\n> But if you write \"ref1:HEAD\", you pretend that you want to fast-forward\n> the local branch \"HEAD\" to ref1, and get an error if it is not\n> forwardable.\n>\n> In your case, I guess, \"git pull ref1\" is what you meant.\n\nI did, I guess...\nConfused now.\n"}]}