{"thread":{"id":"37897","subject":"What is the default refspec for fetch?","startedAt":"2014-11-07T15:31:08Z","lastAt":"2014-11-11T23:04:45Z","messageCount":6,"participants":["Christian Halstrick","Jeff King","Jakub Narębski","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"251458","messageId":"CAENte7inZ5fm2SzNPq=HNPKnPco9tM4T_es5Dphnpbia-uiLdg@mail.gmail.com","threadId":"37897","inReplyTo":null,"subject":"What is the default refspec for fetch?","fromName":"Christian Halstrick","fromEmail":"christian.halstrick@gmail.com","sentAt":"2014-11-07T15:31:08Z","receivedAt":"2014-11-07T15:31:08Z","isPatch":false,"sender":{"key":"christian.halstrick@gmail.com","avatar":"https://gravatar.com/avatar/3598bf518644c7dc32d4dcd8e0554b6a313e12103011862402c83ae2854203ce?d=mp&s=160"},"body":"Hi,\n\nIn a repo where no remote.<name>.fetch config parameter is set what\nshould a \"git fetch\" do? My experiments let me think it's\n\"HEAD:FETCH_HEAD\". Right?\n\nI came to this question after finding out that when I clone repos in\nbare mode then they don't have and explicit remote.<name>.fetch in\ntheir config. But a \"git fetch\" sometimes updated \"something\".\n\nCiao\n  Chris\n"},{"id":"251548","messageId":"20141108105221.GA20750@peff.net","threadId":"37897","inReplyTo":"CAENte7inZ5fm2SzNPq=HNPKnPco9tM4T_es5Dphnpbia-uiLdg@mail.gmail.com","subject":"Re: What is the default refspec for fetch?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-11-08T10:52:21Z","receivedAt":"2014-11-08T10:52:21Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Nov 07, 2014 at 04:31:08PM +0100, Christian Halstrick wrote:\n\n> In a repo where no remote.<name>.fetch config parameter is set what\n> should a \"git fetch\" do? My experiments let me think it's\n> \"HEAD:FETCH_HEAD\". Right?\n\nBasically, yes. We always write FETCH_HEAD, regardless of the refspec.\nWe choose \"HEAD\" if no other refspec was provided. So it is really more\nlike\n\n  git fetch $remote HEAD\n\nThis is what makes one-off bare-url pulls work, like:\n\n  git pull git://...\n\nIt runs fetch under the hood, which writes into FETCH_HEAD, and then we\nmerge that.\n\n-Peff\n"},{"id":"251561","messageId":"545E2A2D.2040205@gmail.com","threadId":"37897","inReplyTo":"20141108105221.GA20750@peff.net","subject":"Re: What is the default refspec for fetch?","fromName":"Jakub Narębski","fromEmail":"jnareb@gmail.com","sentAt":"2014-11-08T14:35:25Z","receivedAt":"2014-11-08T14:35:25Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"W dniu 2014-11-08 11:52, Jeff King pisze:\n> On Fri, Nov 07, 2014 at 04:31:08PM +0100, Christian Halstrick wrote:\n>\n>> In a repo where no remote.<name>.fetch config parameter is set what\n>> should a \"git fetch\" do? My experiments let me think it's\n>> \"HEAD:FETCH_HEAD\". Right?\n>\n> Basically, yes. We always write FETCH_HEAD, regardless of the refspec.\n> We choose \"HEAD\" if no other refspec was provided. So it is really more\n> like\n>\n>    git fetch $remote HEAD\n>\n> This is what makes one-off bare-url pulls work, like:\n>\n>    git pull git://...\n>\n> It runs fetch under the hood, which writes into FETCH_HEAD, and then we\n> merge that.\n\nActually FETCH_HEAD consists of multiple lines, one per ref...\nbut only top ref is merged.\n\n-- \nJakub Narębski\n"},{"id":"251621","messageId":"xmqq7fz4e18x.fsf@gitster.dls.corp.google.com","threadId":"37897","inReplyTo":"545E2A2D.2040205@gmail.com","subject":"Re: What is the default refspec for fetch?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-11-09T17:23:58Z","receivedAt":"2014-11-09T17:23:58Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narębski <jnareb@gmail.com> writes:\n\n> W dniu 2014-11-08 11:52, Jeff King pisze:\n>> On Fri, Nov 07, 2014 at 04:31:08PM +0100, Christian Halstrick wrote:\n>>\n>>> In a repo where no remote.<name>.fetch config parameter is set what\n>>> should a \"git fetch\" do? My experiments let me think it's\n>>> \"HEAD:FETCH_HEAD\". Right?\n>>\n>> Basically, yes. We always write FETCH_HEAD, regardless of the refspec.\n>> We choose \"HEAD\" if no other refspec was provided. So it is really more\n>> like\n>>\n>>    git fetch $remote HEAD\n>>\n>> This is what makes one-off bare-url pulls work, like:\n>>\n>>    git pull git://...\n>>\n>> It runs fetch under the hood, which writes into FETCH_HEAD, and then we\n>> merge that.\n>\n> Actually FETCH_HEAD consists of multiple lines, one per ref...\n> but only top ref is merged.\n\nIncorrect in that \"only top\" is misinformation, and irrelevant in\nthe context of discussing the \"what is fetched in a one-off fetch\".\n"},{"id":"251729","messageId":"CAENte7ggGPgNktH_ArVsjN2yDLADHQApDCzWbQLo_bbCiduk6w@mail.gmail.com","threadId":"37897","inReplyTo":"xmqq7fz4e18x.fsf@gitster.dls.corp.google.com","subject":"Re: What is the default refspec for fetch?","fromName":"Christian Halstrick","fromEmail":"christian.halstrick@gmail.com","sentAt":"2014-11-11T23:01:12Z","receivedAt":"2014-11-11T23:01:12Z","isPatch":false,"sender":{"key":"christian.halstrick@gmail.com","avatar":"https://gravatar.com/avatar/3598bf518644c7dc32d4dcd8e0554b6a313e12103011862402c83ae2854203ce?d=mp&s=160"},"body":"ok, thanks. Then I'll teach JGit to fetch at least \"HEAD\" if nothing\nis configured and nothing explicitly specified as refspec.\nCiao\n  Chris\n\n\nOn Sun, Nov 9, 2014 at 6:23 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Jakub Narębski <jnareb@gmail.com> writes:\n>\n>> W dniu 2014-11-08 11:52, Jeff King pisze:\n>>> On Fri, Nov 07, 2014 at 04:31:08PM +0100, Christian Halstrick wrote:\n>>>\n>>>> In a repo where no remote.<name>.fetch config parameter is set what\n>>>> should a \"git fetch\" do? My experiments let me think it's\n>>>> \"HEAD:FETCH_HEAD\". Right?\n>>>\n>>> Basically, yes. We always write FETCH_HEAD, regardless of the refspec.\n>>> We choose \"HEAD\" if no other refspec was provided. So it is really more\n>>> like\n>>>\n>>>    git fetch $remote HEAD\n>>>\n>>> This is what makes one-off bare-url pulls work, like:\n>>>\n>>>    git pull git://...\n>>>\n>>> It runs fetch under the hood, which writes into FETCH_HEAD, and then we\n>>> merge that.\n>>\n>> Actually FETCH_HEAD consists of multiple lines, one per ref...\n>> but only top ref is merged.\n>\n> Incorrect in that \"only top\" is misinformation, and irrelevant in\n> the context of discussing the \"what is fetched in a one-off fetch\".\n"},{"id":"251730","messageId":"xmqqegt95ofm.fsf@gitster.dls.corp.google.com","threadId":"37897","inReplyTo":"CAENte7ggGPgNktH_ArVsjN2yDLADHQApDCzWbQLo_bbCiduk6w@mail.gmail.com","subject":"Re: What is the default refspec for fetch?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-11-11T23:04:45Z","receivedAt":"2014-11-11T23:04:45Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christian Halstrick <christian.halstrick@gmail.com> writes:\n\n> ok, thanks. Then I'll teach JGit to fetch at least \"HEAD\" if nothing\n> is configured and nothing explicitly specified as refspec.\n\nSounds like a sensible thing to do to match what JGit does to what\nwe did from the time immemorial ;-)\n\nThanks.\n"}]}