{"thread":{"id":"10461","subject":"recent change in git.git/master broke my repos","startedAt":"2007-10-25T14:32:36Z","lastAt":"2007-10-27T20:06:37Z","messageCount":18,"participants":["Randal L. Schwartz","Karl Hasselström","Jeff King","Nicolas Pitre","Daniel Barkalow","Andreas Ericsson","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"57185","messageId":"86oden6z97.fsf@blue.stonehenge.com","threadId":"10461","inReplyTo":null,"subject":"recent change in git.git/master broke my repos","fromName":"Randal L. Schwartz","fromEmail":"merlyn@stonehenge.com","sentAt":"2007-10-25T14:32:36Z","receivedAt":"2007-10-25T14:32:36Z","isPatch":false,"sender":{"key":"merlyn@stonehenge.com","avatar":"https://gravatar.com/avatar/dc528d210743ff0333e6213f9ee7b33b23f1b7bc1f3c5a8c2d819074ecd7ab19?d=mp&s=160"},"body":"\nI have echo \"ref: refs/remotes/origin/master\" >.git/refs/heads/upstream\nso that my daily update script can go:\n\n   git-fetch\n   if [ repo is on master, and is not dirty ];\n      git-merge upstream\n   fi\n\nYesterday that worked.\n\nToday I get a rash of:\n\n  fatal: Couldn't find remote ref refs/remotes/origin/master\n\nfrom my git-fetch.\n\nIs git-fetch broken, or am I?  And if it's me, how do I do what I\nwant instead?\n\nAnd when are we gonna get \"fast forward only\" for git-merge?\n\n-- \nRandal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095\n<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>\nPerl/Unix/security consulting, Technical writing, Comedy, etc. etc.\nSee PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!\n"},{"id":"57188","messageId":"20071025150107.GB31196@diana.vm.bytemark.co.uk","threadId":"10461","inReplyTo":"86oden6z97.fsf@blue.stonehenge.com","subject":"Re: recent change in git.git/master broke my repos","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-10-25T15:01:07Z","receivedAt":"2007-10-25T15:01:07Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2007-10-25 07:32:36 -0700, Randal L. Schwartz wrote:\n\n> And when are we gonna get \"fast forward only\" for git-merge?\n\nI'd like that too. For cases when I know I don't have to do a merge,\nand want git to yell at me if I'm mistaken. For example, in a\nrepository that tracks an upstream so I can build the latest version,\nbut where I don't normally do any development.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"57190","messageId":"20071025155142.GB19655@coredump.intra.peff.net","threadId":"10461","inReplyTo":"86oden6z97.fsf@blue.stonehenge.com","subject":"Re: recent change in git.git/master broke my repos","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-10-25T15:51:42Z","receivedAt":"2007-10-25T15:51:42Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Oct 25, 2007 at 07:32:36AM -0700, Randal L. Schwartz wrote:\n\n> I have echo \"ref: refs/remotes/origin/master\" >.git/refs/heads/upstream\n> so that my daily update script can go:\n> \n>    git-fetch\n>    if [ repo is on master, and is not dirty ];\n>       git-merge upstream\n>    fi\n> \n> Yesterday that worked.\n> \n> Today I get a rash of:\n> \n>   fatal: Couldn't find remote ref refs/remotes/origin/master\n> \n> from my git-fetch.\n\nWorks fine here (meaning I can examine 'upstream' as I would any other\nbranch, and it points to the same place as origin/master).\n\nWhy is git-fetch touching your upstream branch at all? Do you have\nsomething in your .git/config instructing it to do so? Or do you mean\nthat the 'git-merge upstream' command is failing? Can you 'git-show\nupstream'? If not, can you 'git-show origin/master'?\n\n-Peff\n"},{"id":"57191","messageId":"86fxzz6vfh.fsf@blue.stonehenge.com","threadId":"10461","inReplyTo":"20071025155142.GB19655@coredump.intra.peff.net","subject":"Re: recent change in git.git/master broke my repos","fromName":"Randal L. Schwartz","fromEmail":"merlyn@stonehenge.com","sentAt":"2007-10-25T15:55:14Z","receivedAt":"2007-10-25T15:55:14Z","isPatch":false,"sender":{"key":"merlyn@stonehenge.com","avatar":"https://gravatar.com/avatar/dc528d210743ff0333e6213f9ee7b33b23f1b7bc1f3c5a8c2d819074ecd7ab19?d=mp&s=160"},"body":">>>>> \"Jeff\" == Jeff King <peff@peff.net> writes:\n\nJeff> Why is git-fetch touching your upstream branch at all? Do you have\nJeff> something in your .git/config instructing it to do so? Or do you mean\nJeff> that the 'git-merge upstream' command is failing? Can you 'git-show\nJeff> upstream'? If not, can you 'git-show origin/master'?\n\nIt's probably due to this:\n\n[remote \"origin\"]\n        url = [obscured]\n        fetch = +refs/heads/*:refs/remotes/origin/*\n\nfetch wants to sync my heads with the origin heads.  But yes, it's\ndefinitely the fetch that fails under today's version, and not\nunder yesterday's version.\n\n-- \nRandal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095\n<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>\nPerl/Unix/security consulting, Technical writing, Comedy, etc. etc.\nSee PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!\n"},{"id":"57192","messageId":"20071025155712.GA21446@coredump.intra.peff.net","threadId":"10461","inReplyTo":"86fxzz6vfh.fsf@blue.stonehenge.com","subject":"Re: recent change in git.git/master broke my repos","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-10-25T15:57:12Z","receivedAt":"2007-10-25T15:57:12Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Oct 25, 2007 at 08:55:14AM -0700, Randal L. Schwartz wrote:\n\n> It's probably due to this:\n> \n> [remote \"origin\"]\n>         url = [obscured]\n>         fetch = +refs/heads/*:refs/remotes/origin/*\n> \n> fetch wants to sync my heads with the origin heads.  But yes, it's\n> definitely the fetch that fails under today's version, and not\n> under yesterday's version.\n\nSo that should take the remote's refs/heads/* and put them in your\nrefs/remotes/origin/*. I don't see how that would have anything to do\nwith your 'refs/heads/upstream' branch.\n\n-Peff\n"},{"id":"57193","messageId":"86bqan6v9f.fsf@blue.stonehenge.com","threadId":"10461","inReplyTo":"20071025155712.GA21446@coredump.intra.peff.net","subject":"Re: recent change in git.git/master broke my repos","fromName":"Randal L. Schwartz","fromEmail":"merlyn@stonehenge.com","sentAt":"2007-10-25T15:58:52Z","receivedAt":"2007-10-25T15:58:52Z","isPatch":false,"sender":{"key":"merlyn@stonehenge.com","avatar":"https://gravatar.com/avatar/dc528d210743ff0333e6213f9ee7b33b23f1b7bc1f3c5a8c2d819074ecd7ab19?d=mp&s=160"},"body":">>>>> \"Jeff\" == Jeff King <peff@peff.net> writes:\n\nJeff> On Thu, Oct 25, 2007 at 08:55:14AM -0700, Randal L. Schwartz wrote:\n>> It's probably due to this:\n>> \n>> [remote \"origin\"]\n>> url = [obscured]\n>> fetch = +refs/heads/*:refs/remotes/origin/*\n>> \n>> fetch wants to sync my heads with the origin heads.  But yes, it's\n>> definitely the fetch that fails under today's version, and not\n>> under yesterday's version.\n\nJeff> So that should take the remote's refs/heads/* and put them in your\nJeff> refs/remotes/origin/*. I don't see how that would have anything to do\nJeff> with your 'refs/heads/upstream' branch.\n\nAgreed, but that's the place where fetch might look at refs/heads/upstream,\nand the behavior is definitely different between yesterday and today.\n\n-- \nRandal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095\n<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>\nPerl/Unix/security consulting, Technical writing, Comedy, etc. etc.\nSee PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!\n"},{"id":"57194","messageId":"20071025160159.GA21505@coredump.intra.peff.net","threadId":"10461","inReplyTo":"86bqan6v9f.fsf@blue.stonehenge.com","subject":"Re: recent change in git.git/master broke my repos","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-10-25T16:01:59Z","receivedAt":"2007-10-25T16:01:59Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Oct 25, 2007 at 08:58:52AM -0700, Randal L. Schwartz wrote:\n\n> Jeff> So that should take the remote's refs/heads/* and put them in your\n> Jeff> refs/remotes/origin/*. I don't see how that would have anything to do\n> Jeff> with your 'refs/heads/upstream' branch.\n> \n> Agreed, but that's the place where fetch might look at refs/heads/upstream,\n> and the behavior is definitely different between yesterday and today.\n\nFair enough. How about my other questions. Can you 'git-show upstream'?\nCan you 'git-show origin/master'?\n\n-Peff\n"},{"id":"57196","messageId":"867ilb6uwr.fsf@blue.stonehenge.com","threadId":"10461","inReplyTo":"20071025160159.GA21505@coredump.intra.peff.net","subject":"Re: recent change in git.git/master broke my repos","fromName":"Randal L. Schwartz","fromEmail":"merlyn@stonehenge.com","sentAt":"2007-10-25T16:06:28Z","receivedAt":"2007-10-25T16:06:28Z","isPatch":false,"sender":{"key":"merlyn@stonehenge.com","avatar":"https://gravatar.com/avatar/dc528d210743ff0333e6213f9ee7b33b23f1b7bc1f3c5a8c2d819074ecd7ab19?d=mp&s=160"},"body":">>>>> \"Jeff\" == Jeff King <peff@peff.net> writes:\n\nJeff> On Thu, Oct 25, 2007 at 08:58:52AM -0700, Randal L. Schwartz wrote:\nJeff> So that should take the remote's refs/heads/* and put them in your\nJeff> refs/remotes/origin/*. I don't see how that would have anything to do\nJeff> with your 'refs/heads/upstream' branch.\n>> \n>> Agreed, but that's the place where fetch might look at refs/heads/upstream,\n>> and the behavior is definitely different between yesterday and today.\n\nJeff> Fair enough. How about my other questions. Can you 'git-show upstream'?\nJeff> Can you 'git-show origin/master'?\n\nyes, and they show the same thing.\n\n-- \nRandal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095\n<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>\nPerl/Unix/security consulting, Technical writing, Comedy, etc. etc.\nSee PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!\n"},{"id":"57199","messageId":"20071025165633.GA24143@coredump.intra.peff.net","threadId":"10461","inReplyTo":"86oden6z97.fsf@blue.stonehenge.com","subject":"Re: recent change in git.git/master broke my repos","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-10-25T16:56:33Z","receivedAt":"2007-10-25T16:56:33Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Oct 25, 2007 at 07:32:36AM -0700, Randal L. Schwartz wrote:\n\n> I have echo \"ref: refs/remotes/origin/master\" >.git/refs/heads/upstream\n> so that my daily update script can go:\n> \n>    git-fetch\n>    if [ repo is on master, and is not dirty ];\n>       git-merge upstream\n>    fi\n> \n> Yesterday that worked.\n> \n> Today I get a rash of:\n> \n>   fatal: Couldn't find remote ref refs/remotes/origin/master\n> \n> from my git-fetch.\n\nRandal and I discussed this a bit on IRC, and it turns out not to be\nrelated to the 'upstream' symref. Instead, he had a broken\nbranch.master.merge config that pointed to \"refs/remotes/origin/master\"\n(which you can see from his script above doesn't actually get used).\n\nSo presumably the old git-fetch didn't care that the contents of\nbranch.*.master didn't exist (it's just that nothing got marked for\nmerging), but the one just merged from the db/fetch-pack topic does.\n\nIs this behavior change intentional?\n\n-Peff\n"},{"id":"57202","messageId":"alpine.LFD.0.9999.0710251344220.22100@xanadu.home","threadId":"10461","inReplyTo":"20071025150107.GB31196@diana.vm.bytemark.co.uk","subject":"Re: recent change in git.git/master broke my repos","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-10-25T17:46:04Z","receivedAt":"2007-10-25T17:46:04Z","isPatch":false,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Thu, 25 Oct 2007, Karl Hasselström wrote:\n\n> On 2007-10-25 07:32:36 -0700, Randal L. Schwartz wrote:\n> \n> > And when are we gonna get \"fast forward only\" for git-merge?\n> \n> I'd like that too. For cases when I know I don't have to do a merge,\n> and want git to yell at me if I'm mistaken. For example, in a\n> repository that tracks an upstream so I can build the latest version,\n> but where I don't normally do any development.\n\nIsn't that called a remote branch that gets updated with \"git fetch' ?\nYou can even trick Git into not using the refs/remotes/ namespace for \nthem if you wish.\n\n\nNicolas\n"},{"id":"57205","messageId":"Pine.LNX.4.64.0710251351330.7345@iabervon.org","threadId":"10461","inReplyTo":"20071025165633.GA24143@coredump.intra.peff.net","subject":"Re: recent change in git.git/master broke my repos","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2007-10-25T18:05:20Z","receivedAt":"2007-10-25T18:05:20Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Thu, 25 Oct 2007, Jeff King wrote:\n\n> On Thu, Oct 25, 2007 at 07:32:36AM -0700, Randal L. Schwartz wrote:\n> \n> > I have echo \"ref: refs/remotes/origin/master\" >.git/refs/heads/upstream\n> > so that my daily update script can go:\n> > \n> >    git-fetch\n> >    if [ repo is on master, and is not dirty ];\n> >       git-merge upstream\n> >    fi\n> > \n> > Yesterday that worked.\n> > \n> > Today I get a rash of:\n> > \n> >   fatal: Couldn't find remote ref refs/remotes/origin/master\n> > \n> > from my git-fetch.\n> \n> Randal and I discussed this a bit on IRC, and it turns out not to be\n> related to the 'upstream' symref. Instead, he had a broken\n> branch.master.merge config that pointed to \"refs/remotes/origin/master\"\n> (which you can see from his script above doesn't actually get used).\n> \n> So presumably the old git-fetch didn't care that the contents of\n> branch.*.master didn't exist (it's just that nothing got marked for\n> merging), but the one just merged from the db/fetch-pack topic does.\n> \n> Is this behavior change intentional?\n\nIt's not exactly intentional; it's just that nobody seems to have tested \nthis particular misconfiguration. It should probably report an error \n(since the configuration is, in fact, broken and potentially misleading), \nbut it probably shouldn't be fatal and certainly shouldn't be so \nuninformative.\n\nI guess it's a new feature that you can use a branch.*.merge line to \nselect a ref that otherwise wouldn't be fetched at all, cause it to be \nfetched, and have it marked for merging; previously, such a config line \nwould just be ignored, as it didn't exactly match anything. It's a side \neffect that something that doesn't exist (by that name on the remote side) \nis now an issue.\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"57218","messageId":"863avz6oa8.fsf@blue.stonehenge.com","threadId":"10461","inReplyTo":"alpine.LFD.0.9999.0710251344220.22100@xanadu.home","subject":"Re: recent change in git.git/master broke my repos","fromName":"Randal L. Schwartz","fromEmail":"merlyn@stonehenge.com","sentAt":"2007-10-25T18:29:35Z","receivedAt":"2007-10-25T18:29:35Z","isPatch":false,"sender":{"key":"merlyn@stonehenge.com","avatar":"https://gravatar.com/avatar/dc528d210743ff0333e6213f9ee7b33b23f1b7bc1f3c5a8c2d819074ecd7ab19?d=mp&s=160"},"body":">>>>> \"Nicolas\" == Nicolas Pitre <nico@cam.org> writes:\n\nNicolas> Isn't that called a remote branch that gets updated with \"git fetch' ?\nNicolas> You can even trick Git into not using the refs/remotes/ namespace for \nNicolas> them if you wish.\n\nNo.  I have a local master, and I want to be able to blindly say\n\"git-merge\" on that master when doing so is only a fast forward.\n\n\n-- \nRandal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095\n<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>\nPerl/Unix/security consulting, Technical writing, Comedy, etc. etc.\nSee PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!\n"},{"id":"57233","messageId":"4720FB4E.3030300@op5.se","threadId":"10461","inReplyTo":"alpine.LFD.0.9999.0710251344220.22100@xanadu.home","subject":"Re: recent change in git.git/master broke my repos","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2007-10-25T20:23:42Z","receivedAt":"2007-10-25T20:23:42Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Nicolas Pitre wrote:\n> On Thu, 25 Oct 2007, Karl Hasselström wrote:\n> \n>> On 2007-10-25 07:32:36 -0700, Randal L. Schwartz wrote:\n>>\n>>> And when are we gonna get \"fast forward only\" for git-merge?\n>> I'd like that too. For cases when I know I don't have to do a merge,\n>> and want git to yell at me if I'm mistaken. For example, in a\n>> repository that tracks an upstream so I can build the latest version,\n>> but where I don't normally do any development.\n> \n> Isn't that called a remote branch that gets updated with \"git fetch' ?\n> You can even trick Git into not using the refs/remotes/ namespace for \n> them if you wish.\n> \n\nYou'd lose the ability to do \"git diff origin/master\" while disconnected\nthough. It's quite valuable.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"57236","messageId":"alpine.LFD.0.9999.0710251637240.22100@xanadu.home","threadId":"10461","inReplyTo":"4720FB4E.3030300@op5.se","subject":"Re: recent change in git.git/master broke my repos","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-10-25T20:38:06Z","receivedAt":"2007-10-25T20:38:06Z","isPatch":false,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Thu, 25 Oct 2007, Andreas Ericsson wrote:\n\n> Nicolas Pitre wrote:\n> > Isn't that called a remote branch that gets updated with \"git fetch' ?\n> > You can even trick Git into not using the refs/remotes/ namespace for them\n> > if you wish.\n> > \n> \n> You'd lose the ability to do \"git diff origin/master\" while disconnected\n> though. It's quite valuable.\n\nI don't see how you'd lose anything.\n\n\nNicolas\n"},{"id":"57237","messageId":"4720FF98.5080905@op5.se","threadId":"10461","inReplyTo":"alpine.LFD.0.9999.0710251637240.22100@xanadu.home","subject":"Re: recent change in git.git/master broke my repos","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2007-10-25T20:42:00Z","receivedAt":"2007-10-25T20:42:00Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Nicolas Pitre wrote:\n> On Thu, 25 Oct 2007, Andreas Ericsson wrote:\n> \n>> Nicolas Pitre wrote:\n>>> Isn't that called a remote branch that gets updated with \"git fetch' ?\n>>> You can even trick Git into not using the refs/remotes/ namespace for them\n>>> if you wish.\n>>>\n>> You'd lose the ability to do \"git diff origin/master\" while disconnected\n>> though. It's quite valuable.\n> \n> I don't see how you'd lose anything.\n> \n\nSorry, I thought you were talking about a config along the lines of:\nfetch = refs/heads/*:refs/heads/*\n\nWhat other trick are you talking about?\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"57262","messageId":"20071026073955.GB11286@diana.vm.bytemark.co.uk","threadId":"10461","inReplyTo":"alpine.LFD.0.9999.0710251344220.22100@xanadu.home","subject":"Re: recent change in git.git/master broke my repos","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-10-26T07:39:55Z","receivedAt":"2007-10-26T07:39:55Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2007-10-25 13:46:04 -0400, Nicolas Pitre wrote:\n\n> On Thu, 25 Oct 2007, Karl Hasselström wrote:\n>\n> > On 2007-10-25 07:32:36 -0700, Randal L. Schwartz wrote:\n> >\n> > > And when are we gonna get \"fast forward only\" for git-merge?\n> >\n> > I'd like that too. For cases when I know I don't have to do a\n> > merge, and want git to yell at me if I'm mistaken. For example, in\n> > a repository that tracks an upstream so I can build the latest\n> > version, but where I don't normally do any development.\n>\n> Isn't that called a remote branch that gets updated with \"git\n> fetch'?\n\nSure, I could use a detached HEAD instead of a local branch. However,\nthat'll still not warn me that merging in another branch won't be a\nfast-forward.\n\n> You can even trick Git into not using the refs/remotes/ namespace\n> for them if you wish.\n\nI'm not sure what'll happen if git fetch tries to update a branch that\nI've made local changes to, but I don't imagine it's anything\nproductive. If not forced it'll fail, and if forced it'll lose my\nlocal commits. The former might actually be sort of what I want (git\ncomplains when I have local commits), but I'm rather fond of the\nrefs/remotes/ stuff, so this solution sounds like a hack to me. What I\nreally want is an \"extra careful\" merge that is guaranteed to do\nnothing but a fast-forward if it succeeds.\n\nAs is, it's a two-line shell script, though, so it isn't that\nimportant.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"57326","messageId":"7vejfhulzn.fsf@gitster.siamese.dyndns.org","threadId":"10461","inReplyTo":"Pine.LNX.4.64.0710251351330.7345@iabervon.org","subject":"Re: recent change in git.git/master broke my repos","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-10-27T06:09:48Z","receivedAt":"2007-10-27T06:09:48Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Daniel Barkalow <barkalow@iabervon.org> writes:\n\n> On Thu, 25 Oct 2007, Jeff King wrote:\n>\n>> On Thu, Oct 25, 2007 at 07:32:36AM -0700, Randal L. Schwartz wrote:\n>> \n>> > I have echo \"ref: refs/remotes/origin/master\" >.git/refs/heads/upstream\n>> > so that my daily update script can go:\n>> > \n>> >    git-fetch\n>> >    if [ repo is on master, and is not dirty ];\n>> >       git-merge upstream\n>> >    fi\n>> > \n>> > Yesterday that worked.\n>> > \n>> > Today I get a rash of:\n>> > \n>> >   fatal: Couldn't find remote ref refs/remotes/origin/master\n>> > \n>> > from my git-fetch.\n>> \n>> Randal and I discussed this a bit on IRC, and it turns out not to be\n>> related to the 'upstream' symref. Instead, he had a broken\n>> branch.master.merge config that pointed to \"refs/remotes/origin/master\"\n>> (which you can see from his script above doesn't actually get used).\n>> \n>> So presumably the old git-fetch didn't care that the contents of\n>> branch.*.master didn't exist (it's just that nothing got marked for\n>> merging), but the one just merged from the db/fetch-pack topic does.\n>> \n>> Is this behavior change intentional?\n>\n> It's not exactly intentional; it's just that nobody seems to have tested \n> this particular misconfiguration. It should probably report an error \n> (since the configuration is, in fact, broken and potentially misleading), \n> but it probably shouldn't be fatal and certainly shouldn't be so \n> uninformative.\n\nHow would we proceed from here, then?\n\nIf you had \"branch.master.merge = refs/heads/foobar\", kept\nrunning happily, and suddenly the remote stopped carrying that\nfoobar branch, you would get a configuration that uses\nnonexistent remote branch name, so this is not purely a\nconfiguration error on the fetcher's side.\n\nOlder git used to enumerate remote tracking branches explicitly,\nand one of the remote.origin.fetch entries would have said\n\"refs/heads/foobar:refs/remotes/origin/foobar\", and that would\nhave made git-fetch fail with the error, complaining that such a\nbranch does not exist.\n\nYou are suggesting that git-fetch should not fail if\nremote.origin.fetch is refs/heads/*:refs/remotes/origin/*\nwildcard, and I think I can agree with that; \"git pull\" however\nshould notice and and exit with an error.\n\nPerhaps something like this?\n\n-- >8 --\n[PATCH] git-fetch: do not fail when remote branch disappears\n\nWhen the branch named with branch.$name.merge is not covered by\nthe fetch configuration for the remote repository named with\nbranch.$name.remote, we automatically add that branch to the set\nof branches to be fetched.  However, if the remote repository\ndoes not have that branch (e.g. it used to exist, but got\nremoved), this is not a reason to fail the git-fetch itself.\n\nThe situation however will be noticed if git-fetch was called by\ngit-pull, as the resulting FETCH_HEAD would not have any entry\nthat is marked for merging.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n\n builtin-fetch.c |   24 ++++++++++++++++--------\n remote.c        |   22 +++++++++++++---------\n remote.h        |    5 ++++-\n 3 files changed, 33 insertions(+), 18 deletions(-)\n\ndiff --git a/builtin-fetch.c b/builtin-fetch.c\nindex b9d2b0c..003ed76 100644\n--- a/builtin-fetch.c\n+++ b/builtin-fetch.c\n@@ -48,15 +48,21 @@ static void add_merge_config(struct ref **head,\n \t\tif (rm)\n \t\t\tcontinue;\n \n-\t\t/* Not fetched to a tracking branch?  We need to fetch\n+\t\t/*\n+\t\t * Not fetched to a tracking branch?  We need to fetch\n \t\t * it anyway to allow this branch's \"branch.$name.merge\"\n-\t\t * to be honored by git-pull.\n+\t\t * to be honored by git-pull, but we do not have to\n+\t\t * fail if branch.$name.merge is misconfigured to point\n+\t\t * at a nonexisting branch.  If we were indeed called by\n+\t\t * git-pull, it will notice the misconfiguration because\n+\t\t * there is no entry in the resulting FETCH_HEAD marked\n+\t\t * for merging.\n \t\t */\n \t\trefspec.src = branch->merge[i]->src;\n \t\trefspec.dst = NULL;\n \t\trefspec.pattern = 0;\n \t\trefspec.force = 0;\n-\t\tget_fetch_map(remote_refs, &refspec, tail);\n+\t\tget_fetch_map(remote_refs, &refspec, tail, 1);\n \t\tfor (rm = *old_tail; rm; rm = rm->next)\n \t\t\trm->merge = 1;\n \t}\n@@ -75,7 +81,7 @@ static struct ref *get_ref_map(struct transport *transport,\n \n \tif (ref_count || tags) {\n \t\tfor (i = 0; i < ref_count; i++) {\n-\t\t\tget_fetch_map(remote_refs, &refs[i], &tail);\n+\t\t\tget_fetch_map(remote_refs, &refs[i], &tail, 0);\n \t\t\tif (refs[i].dst && refs[i].dst[0])\n \t\t\t\t*autotags = 1;\n \t\t}\n@@ -88,7 +94,7 @@ static struct ref *get_ref_map(struct transport *transport,\n \t\t\trefspec.dst = \"refs/tags/\";\n \t\t\trefspec.pattern = 1;\n \t\t\trefspec.force = 0;\n-\t\t\tget_fetch_map(remote_refs, &refspec, &tail);\n+\t\t\tget_fetch_map(remote_refs, &refspec, &tail, 0);\n \t\t}\n \t} else {\n \t\t/* Use the defaults */\n@@ -97,7 +103,7 @@ static struct ref *get_ref_map(struct transport *transport,\n \t\tint has_merge = branch_has_merge_config(branch);\n \t\tif (remote && (remote->fetch_refspec_nr || has_merge)) {\n \t\t\tfor (i = 0; i < remote->fetch_refspec_nr; i++) {\n-\t\t\t\tget_fetch_map(remote_refs, &remote->fetch[i], &tail);\n+\t\t\t\tget_fetch_map(remote_refs, &remote->fetch[i], &tail, 0);\n \t\t\t\tif (remote->fetch[i].dst &&\n \t\t\t\t    remote->fetch[i].dst[0])\n \t\t\t\t\t*autotags = 1;\n@@ -110,11 +116,13 @@ static struct ref *get_ref_map(struct transport *transport,\n \t\t\t * as given in branch.<name>.remote, we add the\n \t\t\t * ref given in branch.<name>.merge, too.\n \t\t\t */\n-\t\t\tif (has_merge && !strcmp(branch->remote_name,\n-\t\t\t\t\t\tremote->name))\n+\t\t\tif (has_merge &&\n+\t\t\t    !strcmp(branch->remote_name, remote->name))\n \t\t\t\tadd_merge_config(&ref_map, remote_refs, branch, &tail);\n \t\t} else {\n \t\t\tref_map = get_remote_ref(remote_refs, \"HEAD\");\n+\t\t\tif (!ref_map)\n+\t\t\t\tdie(\"Couldn't find remote ref HEAD\");\n \t\t\tref_map->merge = 1;\n \t\t}\n \t}\ndiff --git a/remote.c b/remote.c\nindex 170015a..bec2ba1 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -857,7 +857,7 @@ struct ref *get_remote_ref(struct ref *remote_refs, const char *name)\n \tstruct ref *ref = find_ref_by_name_abbrev(remote_refs, name);\n \n \tif (!ref)\n-\t\tdie(\"Couldn't find remote ref %s\\n\", name);\n+\t\treturn NULL;\n \n \treturn copy_ref(ref);\n }\n@@ -889,20 +889,24 @@ static struct ref *get_local_ref(const char *name)\n \n int get_fetch_map(struct ref *remote_refs,\n \t\t  const struct refspec *refspec,\n-\t\t  struct ref ***tail)\n+\t\t  struct ref ***tail,\n+\t\t  int missing_ok)\n {\n \tstruct ref *ref_map, *rm;\n \n \tif (refspec->pattern) {\n \t\tref_map = get_expanded_map(remote_refs, refspec);\n \t} else {\n-\t\tref_map = get_remote_ref(remote_refs,\n-\t\t\t\t\t refspec->src[0] ?\n-\t\t\t\t\t refspec->src : \"HEAD\");\n-\n-\t\tref_map->peer_ref = get_local_ref(refspec->dst);\n-\t\tif (ref_map->peer_ref && refspec->force)\n-\t\t\tref_map->peer_ref->force = 1;\n+\t\tconst char *name = refspec->src[0] ? refspec->src : \"HEAD\";\n+\n+\t\tref_map = get_remote_ref(remote_refs, name);\n+\t\tif (!missing_ok && !ref_map)\n+\t\t\tdie(\"Couldn't find remote ref %s\", name);\n+\t\tif (ref_map) {\n+\t\t\tref_map->peer_ref = get_local_ref(refspec->dst);\n+\t\t\tif (ref_map->peer_ref && refspec->force)\n+\t\t\t\tref_map->peer_ref->force = 1;\n+\t\t}\n \t}\n \n \tfor (rm = ref_map; rm; rm = rm->next) {\ndiff --git a/remote.h b/remote.h\nindex c62636d..878b4ec 100644\n--- a/remote.h\n+++ b/remote.h\n@@ -67,9 +67,12 @@ int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,\n  * *tail is the pointer to the tail pointer of the list of results\n  * beforehand, and will be set to the tail pointer of the list of\n  * results afterward.\n+ *\n+ * missing_ok is usually false, but when we are adding branch.$name.merge\n+ * it is Ok if the branch is not at the remote anymore.\n  */\n int get_fetch_map(struct ref *remote_refs, const struct refspec *refspec,\n-\t\t  struct ref ***tail);\n+\t\t  struct ref ***tail, int missing_ok);\n \n struct ref *get_remote_ref(struct ref *remote_refs, const char *name);\n \n"},{"id":"57373","messageId":"Pine.LNX.4.64.0710271600440.7345@iabervon.org","threadId":"10461","inReplyTo":"7vejfhulzn.fsf@gitster.siamese.dyndns.org","subject":"Re: recent change in git.git/master broke my repos","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2007-10-27T20:06:37Z","receivedAt":"2007-10-27T20:06:37Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Fri, 26 Oct 2007, Junio C Hamano wrote:\n\n> Daniel Barkalow <barkalow@iabervon.org> writes:\n> \n> > On Thu, 25 Oct 2007, Jeff King wrote:\n> >\n> >> On Thu, Oct 25, 2007 at 07:32:36AM -0700, Randal L. Schwartz wrote:\n> >> \n> >> > I have echo \"ref: refs/remotes/origin/master\" >.git/refs/heads/upstream\n> >> > so that my daily update script can go:\n> >> > \n> >> >    git-fetch\n> >> >    if [ repo is on master, and is not dirty ];\n> >> >       git-merge upstream\n> >> >    fi\n> >> > \n> >> > Yesterday that worked.\n> >> > \n> >> > Today I get a rash of:\n> >> > \n> >> >   fatal: Couldn't find remote ref refs/remotes/origin/master\n> >> > \n> >> > from my git-fetch.\n> >> \n> >> Randal and I discussed this a bit on IRC, and it turns out not to be\n> >> related to the 'upstream' symref. Instead, he had a broken\n> >> branch.master.merge config that pointed to \"refs/remotes/origin/master\"\n> >> (which you can see from his script above doesn't actually get used).\n> >> \n> >> So presumably the old git-fetch didn't care that the contents of\n> >> branch.*.master didn't exist (it's just that nothing got marked for\n> >> merging), but the one just merged from the db/fetch-pack topic does.\n> >> \n> >> Is this behavior change intentional?\n> >\n> > It's not exactly intentional; it's just that nobody seems to have tested \n> > this particular misconfiguration. It should probably report an error \n> > (since the configuration is, in fact, broken and potentially misleading), \n> > but it probably shouldn't be fatal and certainly shouldn't be so \n> > uninformative.\n> \n> How would we proceed from here, then?\n> \n> If you had \"branch.master.merge = refs/heads/foobar\", kept\n> running happily, and suddenly the remote stopped carrying that\n> foobar branch, you would get a configuration that uses\n> nonexistent remote branch name, so this is not purely a\n> configuration error on the fetcher's side.\n\nTrue, although I'd consider that a matter of configuration rot rather than \nit being an okay configuration; the user probably still needs to figure \nout what happened to it and what to use instead. Maybe we want to output a \nmessage to stderr (although higher than the die() used to be, so that we \ncan report the reason that it was looking for the missing remote ref).\n\n> Older git used to enumerate remote tracking branches explicitly,\n> and one of the remote.origin.fetch entries would have said\n> \"refs/heads/foobar:refs/remotes/origin/foobar\", and that would\n> have made git-fetch fail with the error, complaining that such a\n> branch does not exist.\n> \n> You are suggesting that git-fetch should not fail if\n> remote.origin.fetch is refs/heads/*:refs/remotes/origin/*\n> wildcard, and I think I can agree with that; \"git pull\" however\n> should notice and and exit with an error.\n> \n> Perhaps something like this?\n\nThat looks like what I was going to write when I got to it (although I \nwould have had the flag inverted, which is less git style, I guess).\n\nAcked-By: Daniel Barkalow <barkalow@iabervon.org>\n\n\t-Daniel\n*This .sig left intentionally blank*\n"}]}