{"thread":{"id":"5241","subject":"RFC: git pull <remote> making an octopus?","startedAt":"2006-08-14T06:43:36Z","lastAt":"2006-08-17T09:46:47Z","messageCount":10,"participants":["Michael S. Tsirkin","Junio C Hamano","Alex Riesen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"25226","messageId":"20060814064336.GE21963@mellanox.co.il","threadId":"5241","inReplyTo":null,"subject":"RFC: git pull <remote> making an octopus?","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2006-08-14T06:43:36Z","receivedAt":"2006-08-14T06:43:36Z","isPatch":false,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Hi!\nIf I do\n\n$git pull origin\n\nwhere origin is a file in .git/remotes/origin with multiple Pull: lines,\nthen I seem to get an octopus merge. I would expect it to behave\nin the same way as git pull without parameters.\nIs this a bug or a feature?\n\nMy git pull page says:\n              While\n              git-pull run without  any  explicit  <refspec>  parameter  takes\n              default  <refspec>s  from  Pull: lines, it merges only the first\n              <refspec> found into the current branch, after fetching all  the\n              remote  refs. This is because making an Octopus from remote refs\n              is rarely done, while keeping track of multiple remote heads  in\n              one-go by fetching more than one is often useful.\n\nSo, the same logic seems to apply to anything under .git/remotes.\nRight?\n\n-- \nMST\n"},{"id":"25227","messageId":"7vac67g5t5.fsf@assigned-by-dhcp.cox.net","threadId":"5241","inReplyTo":"20060814064336.GE21963@mellanox.co.il","subject":"Re: RFC: git pull <remote> making an octopus?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-08-14T07:00:38Z","receivedAt":"2006-08-14T07:00:38Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n\n> $ git pull origin\n>\n> where origin is a file in .git/remotes/origin with multiple Pull: lines,\n> then I seem to get an octopus merge.\n\nYou shouldn't.\n\nI have four Pull: lines like these for .git/remotes/ko\n\n        URL: kernel.org:/pub/scm/git/git.git/\n        Pull: master:refs/tags/ko-master\n        Pull: next:refs/tags/ko-next\n        Pull: +pu:refs/tags/ko-pu\n        Pull: maint:refs/tags/ko-maint\n        Push: heads/master\n        Push: heads/next\n        Push: +heads/pu\n        Push: heads/maint\n\nand \"git pull ko\" leaves this in .git/FETCH_HEAD:\n\n        460c...\t\tbranch 'master' of .kernel.org:/pub/scm/git/git\n        767f...\tnot-for-merge\tbranch 'next' of .kernel.org:/pub/scm/git/git\n        9bd4...\tnot-for-merge\tbranch 'pu' of .kernel.org:/pub/scm/git/git\n        9a1a...\tnot-for-merge\tbranch 'maint' of .kernel.org:/pub/scm/git/git\n\nThe latter three are not merged into the current branch with the\nabove pull command.\n\nAre you by any chance running a version of git that has some\nunofficial patches that affect the generation of not-for-merge\nmarkers?\n"},{"id":"25231","messageId":"20060814075305.GH21963@mellanox.co.il","threadId":"5241","inReplyTo":"7vac67g5t5.fsf@assigned-by-dhcp.cox.net","subject":"Re: RFC: git pull <remote> making an octopus?","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2006-08-14T07:53:05Z","receivedAt":"2006-08-14T07:53:05Z","isPatch":false,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Quoting r. Junio C Hamano <junkio@cox.net>:\n> Are you by any chance running a version of git that has some\n> unofficial patches that affect the generation of not-for-merge\n> markers?\n\nNo, I just reproduced this on plain 1.4.2.\nMy .git/remotes/origin has:\n\nURL: /mswg/git/infiniband/.git\nPull: refs/heads/ofed_1_1:refs/heads/ofed_1_1\nPull: refs/heads/cma_branch:refs/heads/cma_branch\nPull: refs/heads/linus_master:refs/heads/linus_master\nPull: refs/heads/master:refs/heads/master\nPull: refs/heads/mst_sdp:refs/heads/mst_sdp\nPull: refs/heads/ofed_addons:refs/heads/origin\n\nMoving the last line\nPull: refs/heads/ofed_addons:refs/heads/origin\nto be the first, like this\n\nPull: refs/heads/ofed_addons:refs/heads/origin\nPull: refs/heads/ofed_1_1:refs/heads/ofed_1_1\nPull: refs/heads/cma_branch:refs/heads/cma_branch\nPull: refs/heads/linus_master:refs/heads/linus_master\nPull: refs/heads/master:refs/heads/master\nPull: refs/heads/mst_sdp:refs/heads/mst_sdp\n\nfixes the issue.\n\nSo it seems git pull behaves differently depending on whether\nthe origin pull line is first or not?\n\n-- \nMST\n"},{"id":"25272","messageId":"20060814175523.GC16821@mellanox.co.il","threadId":"5241","inReplyTo":"20060814075305.GH21963@mellanox.co.il","subject":"Re: RFC: git pull <remote> making an octopus?","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2006-08-14T17:55:23Z","receivedAt":"2006-08-14T17:55:23Z","isPatch":false,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Quoting r. Michael S. Tsirkin <mst@mellanox.co.il>:\n> So it seems git pull behaves differently depending on whether\n> the origin pull line is first or not?\n\nWhere do I find the code that decides whether to make an octopus\nor many fetches?\n\n-- \nMST\n"},{"id":"25314","messageId":"7vk65bdm9f.fsf@assigned-by-dhcp.cox.net","threadId":"5241","inReplyTo":"20060814175523.GC16821@mellanox.co.il","subject":"Re: RFC: git pull <remote> making an octopus?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-08-14T21:45:48Z","receivedAt":"2006-08-14T21:45:48Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n\n> Quoting r. Michael S. Tsirkin <mst@mellanox.co.il>:\n>> So it seems git pull behaves differently depending on whether\n>> the origin pull line is first or not?\n>\n> Where do I find the code that decides whether to make an octopus\n> or many fetches?\n\nAfter \"git fetch\" that is called from \"git pull\",\n$GIT_DIR/FETCH_HEAD lists all the refs that were fetched, and\neach line has not-for-merge marker (or empty) in the second\ncolumn (SHA1 <TAB> marker <TAB> description of what the remote\nref is).  The ones not marked with the not-for-merge marker are\nmerged into the current head, so if you have more than one that\nlack not-for-merge marker, you end up with an octopus.\n\nThe rule (the implementation might be broken but nobody other\nthan you found the breakage so far) to mark not-for-merge is:\n\n - the refspecs are either given on the command line, or from\n   shorthand file (.git/remotes/, or .git/branches/) but never\n   from both at the same time;\n\n - when dealing with the refspecs from the command line all of\n   them are for merge;\n\n - when dealing with the refspecs from the shorthand\n   (.git/remotes), the one on the first \"Pull: \" line is for\n   merge and everything else is not.\n\nThe case statement in the loop you were touching in your patch\nwe discussed earlier had four arms (+ref, .+ref, .ref, and ref).\nPluses come from the original refspec given by the user, either\nfrom short-hand file or command line.  Dot is prepended when\nreflist is prepared by get_remote_refs_for_fetch which in turn\ncalls canon_refs_list_for_fetch (git-fetch sources\ngit-parse-remote and these shell functions are defined there).\n"},{"id":"25341","messageId":"81b0412b0608150040m422e695fl68650dad6b692533@mail.gmail.com","threadId":"5241","inReplyTo":"7vk65bdm9f.fsf@assigned-by-dhcp.cox.net","subject":"Re: RFC: git pull <remote> making an octopus?","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2006-08-15T07:40:06Z","receivedAt":"2006-08-15T07:40:06Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 8/14/06, Junio C Hamano <junkio@cox.net> wrote:\n>  - when dealing with the refspecs from the shorthand\n>    (.git/remotes), the one on the first \"Pull: \" line is for\n>    merge and everything else is not.\n\nWhat happens if you have _many_ refspecs in a \"Pull:\"-line?\n"},{"id":"25343","messageId":"7vr6zi8mrv.fsf@assigned-by-dhcp.cox.net","threadId":"5241","inReplyTo":"81b0412b0608150040m422e695fl68650dad6b692533@mail.gmail.com","subject":"Re: RFC: git pull <remote> making an octopus?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-08-15T07:45:56Z","receivedAt":"2006-08-15T07:45:56Z","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 8/14/06, Junio C Hamano <junkio@cox.net> wrote:\n>>  - when dealing with the refspecs from the shorthand\n>>    (.git/remotes), the one on the first \"Pull: \" line is for\n>>    merge and everything else is not.\n>\n> What happens if you have _many_ refspecs in a \"Pull:\"-line?\n\nYou should be able to make octopus -- I designed it that way on\npurpose, but I haven't used that (mis)-\"feature\" for quite a\nwhile, so it might have got broken along the way ;-).\n"},{"id":"25458","messageId":"7v1wrfu3tl.fsf@assigned-by-dhcp.cox.net","threadId":"5241","inReplyTo":"20060814075305.GH21963@mellanox.co.il","subject":"Re: RFC: git pull <remote> making an octopus?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-08-17T09:08:54Z","receivedAt":"2006-08-17T09:08:54Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n\n> Quoting r. Junio C Hamano <junkio@cox.net>:\n>> Are you by any chance running a version of git that has some\n>> unofficial patches that affect the generation of not-for-merge\n>> markers?\n>\n> No, I just reproduced this on plain 1.4.2.\n\nDoesn't reproduce for me and I am getting worried.\nHas anybody else seen this?\n"},{"id":"25460","messageId":"81b0412b0608170218o16253515mbc9846847dfbbee6@mail.gmail.com","threadId":"5241","inReplyTo":"7v1wrfu3tl.fsf@assigned-by-dhcp.cox.net","subject":"Re: RFC: git pull <remote> making an octopus?","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2006-08-17T09:18:57Z","receivedAt":"2006-08-17T09:18:57Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 8/17/06, Junio C Hamano <junkio@cox.net> wrote:\n> >> Are you by any chance running a version of git that has some\n> >> unofficial patches that affect the generation of not-for-merge\n> >> markers?\n> >\n> > No, I just reproduced this on plain 1.4.2.\n>\n> Doesn't reproduce for me and I am getting worried.\n> Has anybody else seen this?\n>\n\nI haven't. Michael, could you retry with \"GIT_TRACE=1 sh -x -v git-pull\" ?\nI suspect invisible (like \\r) character in your remotes. Missing last \\n could\nbe interesting too.\n"},{"id":"25474","messageId":"20060817094647.GG2630@mellanox.co.il","threadId":"5241","inReplyTo":"7v1wrfu3tl.fsf@assigned-by-dhcp.cox.net","subject":"Re: RFC: git pull <remote> making an octopus?","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2006-08-17T09:46:47Z","receivedAt":"2006-08-17T09:46:47Z","isPatch":false,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Quoting r. Junio C Hamano <junkio@cox.net>:\n> > No, I just reproduced this on plain 1.4.2.\n> \n> Doesn't reproduce for me and I am getting worried.\n\nNo, that was my mistake, sorry about not clarifying that.\n\nBasically what confused me was the following text in get-fetch manpage:\n\n\tWhile git-pull  run  without  any  explicit <refspec> parameter takes\n\tdefault <refspec>s from Pull: lines, it merges only  the  first\n\t<refspec> found into the current branch, after fetching all the remote\n\trefs.\n\nAnd this actually applied to remotes in $GITDIR/remotes and not just\nwhen git-pull is run without any parameters.\n\n-- \nMST\n"}]}