{"thread":{"id":"8305","subject":"Pulling from refs/remotes/ ?","startedAt":"2007-05-25T01:12:45Z","lastAt":"2007-05-26T19:47:56Z","messageCount":7,"participants":["Han-Wen Nienhuys","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"43197","messageId":"f35d9n$21e$1@sea.gmane.org","threadId":"8305","inReplyTo":null,"subject":"Pulling from refs/remotes/ ?","fromName":"Han-Wen Nienhuys","fromEmail":"hanwen@xs4all.nl","sentAt":"2007-05-25T01:12:45Z","receivedAt":"2007-05-25T01:12:45Z","isPatch":false,"sender":{"key":"hanwen@google.com","avatar":"https://avatars.githubusercontent.com/u/31547?v=4"},"body":"\nHi,\n\nwhy can't I pull from a remote?  I can do \n\n  git log REMOTE-BRANCH\n  git diff BRANCH REMOTE-BRANCH\n\netc. But pulling yields\n\n [hanwen@haring foobar]$ git pull . origin/nonrandr-setup\n error: no such remote ref refs/heads/origin/nonrandr-setup\n Fetch failure: .\n\nalso, \"Fetch failure: .\", what is that supposed to mean?\n\n-- \n Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen\n"},{"id":"43198","messageId":"7v7iqxvgx8.fsf@assigned-by-dhcp.cox.net","threadId":"8305","inReplyTo":"f35d9n$21e$1@sea.gmane.org","subject":"Re: Pulling from refs/remotes/ ?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-05-25T01:19:15Z","receivedAt":"2007-05-25T01:19:15Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Han-Wen Nienhuys <hanwen@xs4all.nl> writes:\n\n> why can't I pull from a remote?  I can do \n>\n>   git log REMOTE-BRANCH\n>   git diff BRANCH REMOTE-BRANCH\n>\n> etc. But pulling yields\n>\n>  [hanwen@haring foobar]$ git pull . origin/nonrandr-setup\n>  error: no such remote ref refs/heads/origin/nonrandr-setup\n>  Fetch failure: .\n>\n> also, \"Fetch failure: .\", what is that supposed to mean?\n\nYou are treating your local repository as if it is a remote\nrepository somewhere else, namely, '.' (current repository).\n\nNotice \"git log\" and \"git diff\" are LOCAL operations?  \"git\npull\" is \"git fetch\" which is a remote operation (i.e. it\ninteracts with a remote repository) followed by \"git merge\"\nwhich is a local operation to merge in what was fetched or what\nyou already have locally.\n\nI think you would want:\n\n\tgit merge REMOTE-BRANCH\n\ne.g. \"git merge origin/nonrandr-setup\".\n"},{"id":"43199","messageId":"46563D55.3070607@xs4all.nl","threadId":"8305","inReplyTo":"7v7iqxvgx8.fsf@assigned-by-dhcp.cox.net","subject":"Re: Pulling from refs/remotes/ ?","fromName":"Han-Wen Nienhuys","fromEmail":"hanwen@xs4all.nl","sentAt":"2007-05-25T01:35:17Z","receivedAt":"2007-05-25T01:35:17Z","isPatch":false,"sender":{"key":"hanwen@google.com","avatar":"https://avatars.githubusercontent.com/u/31547?v=4"},"body":"Junio C Hamano escreveu:\n> Han-Wen Nienhuys <hanwen@xs4all.nl> writes:\n> \n>> why can't I pull from a remote?  I can do \n>>\n>>   git log REMOTE-BRANCH\n>>   git diff BRANCH REMOTE-BRANCH\n>>\n>> etc. But pulling yields\n>>\n>>  [hanwen@haring foobar]$ git pull . origin/nonrandr-setup\n>>  error: no such remote ref refs/heads/origin/nonrandr-setup\n>>  Fetch failure: .\n>>\n>> also, \"Fetch failure: .\", what is that supposed to mean?\n> \n> You are treating your local repository as if it is a remote\n> repository somewhere else, namely, '.' (current repository).\n> \n> Notice \"git log\" and \"git diff\" are LOCAL operations?  \"git\n> pull\" is \"git fetch\" which is a remote operation (i.e. it\n> interacts with a remote repository) followed by \"git merge\"\n> which is a local operation to merge in what was fetched or what\n> you already have locally.\n> \n> I think you would want:\n> \n> \tgit merge REMOTE-BRANCH\n> \n> e.g. \"git merge origin/nonrandr-setup\".\n\nYes, that works, thanks. Wouldn't it be more consistent with this\nreasoning to disallow \n\n  git pull . LOCAL-BRANCH \n\ntoo?\n\nI still think that \"fetch failure\" is a bad error message. \nWhat information does it convey?\n\n\n-- \n Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen\n"},{"id":"43203","messageId":"7v3b1lvfc5.fsf@assigned-by-dhcp.cox.net","threadId":"8305","inReplyTo":"46563D55.3070607@xs4all.nl","subject":"Re: Pulling from refs/remotes/ ?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-05-25T01:53:30Z","receivedAt":"2007-05-25T01:53:30Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Han-Wen Nienhuys <hanwen@xs4all.nl> writes:\n\n> Yes, that works, thanks. Wouldn't it be more consistent with this\n> reasoning to disallow \n>\n>   git pull . LOCAL-BRANCH \n>\n> too?\n\nI do not think so.\n\nIf somebody else (or yourself) did:\n\n\t$ git pull $dir LOCAL-BRANCH\n\n(replace $dir with the `pwd` you would get in your repository),\nthat would work.  Why shouldn't it work for yourself?\n"},{"id":"43210","messageId":"465648EA.8070608@xs4all.nl","threadId":"8305","inReplyTo":"7v3b1lvfc5.fsf@assigned-by-dhcp.cox.net","subject":"Re: Pulling from refs/remotes/ ?","fromName":"Han-Wen Nienhuys","fromEmail":"hanwen@xs4all.nl","sentAt":"2007-05-25T02:24:42Z","receivedAt":"2007-05-25T02:24:42Z","isPatch":false,"sender":{"key":"hanwen@google.com","avatar":"https://avatars.githubusercontent.com/u/31547?v=4"},"body":"Junio C Hamano escreveu:\n> Han-Wen Nienhuys <hanwen@xs4all.nl> writes:\n> \n>> Yes, that works, thanks. Wouldn't it be more consistent with this\n>> reasoning to disallow \n>>\n>>   git pull . LOCAL-BRANCH \n>>\n>> too?\n> \n> I do not think so.\n> \n> If somebody else (or yourself) did:\n> \n> \t$ git pull $dir LOCAL-BRANCH\n> \n> (replace $dir with the `pwd` you would get in your repository),\n> that would work.  Why shouldn't it work for yourself?\n \nBecause\n\n\"You are treating your local repository as if it is a remote\nrepository somewhere else, namely, '.' (current repository).\"\n\nthat was the justification for not being able to pull in a remote\nbranch.  This justification (which I disagree with) applies to this\ncase as well.\n\nI understand that we don't want people committing to\nremotes, because fetches will then later fail, but other than \nthat, why should there be limitations on using a remote?\n\n-- \n Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen\n"},{"id":"43215","messageId":"7vwsyxsit8.fsf@assigned-by-dhcp.cox.net","threadId":"8305","inReplyTo":"465648EA.8070608@xs4all.nl","subject":"Re: Pulling from refs/remotes/ ?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-05-25T03:06:43Z","receivedAt":"2007-05-25T03:06:43Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Han-Wen Nienhuys <hanwen@xs4all.nl> writes:\n\n>> If somebody else (or yourself) did:\n>> \n>> \t$ git pull $dir LOCAL-BRANCH\n>> \n>> (replace $dir with the `pwd` you would get in your repository),\n>> that would work.  Why shouldn't it work for yourself?\n>  \n> Because\n>\n> \"You are treating your local repository as if it is a remote\n> repository somewhere else, namely, '.' (current repository).\"\n>\n> that was the justification for not being able to pull in a remote\n> branch.  This justification (which I disagree with) applies to this\n> case as well.\n\nAh, so \"forbidding a pull of local branch\" was tongue-in-cheek\ncomment, and what you really wanted was to allow pulling remote\ntracking branch with pull, either inside or outside of a\nrepository, like...\n\n\t$ git pull $somebody_elses_repo remotes/origin/master\n\nwithout having to say \"remotes/\"?\n\nThat one comes from a different design issue.  refs/remotes/\nhierarchy is local to your repository, and is not subject to\nremote operation.\n\n> I understand that we don't want people committing to\n> remotes, because fetches will then later fail, but other than \n> that, why should there be limitations on using a remote?\n\nMy stance on this is that what I track as my upstream to\nmaintain my repository is none of other people's business.  I\nhave remote tracking branches because I use them to track\nothers; I do not necessarily have them with an intention to\npublish them.\n\nYou could pull from my remote tracking branches using the fuller\nrefspec (\"remotes/origin/master\" in the example above) if you\nreally wanted to, and ls-remote lets you take a peek at them, so\nthe above \"none of your business\" is not in the sense of being\nsecretive, but is to reduce clutter and to avoid potential\nconfusion.\n\nBut this is an ancient design choice, and I am open to\nsuggestions loosening it, as long as we are aware of\nimplications.\n\nOne thing that comes to mind if we allow it is if a clone should\nhave refs/remotes/origin/remotes/origin/* that keeps track of\nthe remote that is being tracked by your origin.\n\nI think it is insane to do so, but if somebody says \"git pull\nsomewhere-else origin/master\", we would not know if he meant\nremotes/origin/master or remotes/origin/remotes/origin/master.\n\nAnd the reason it is \"insane\" is the same as why we currently do\nnot interpret \"git pull $repo origin/master\" as a request to\npull from remotes/origin/master.  It really is none of your\nbusiness what kind of remote branches the other end is\ninteracting with.\n"},{"id":"43364","messageId":"46588EEC.4080101@xs4all.nl","threadId":"8305","inReplyTo":"7vwsyxsit8.fsf@assigned-by-dhcp.cox.net","subject":"Re: Pulling from refs/remotes/ ?","fromName":"Han-Wen Nienhuys","fromEmail":"hanwen@xs4all.nl","sentAt":"2007-05-26T19:47:56Z","receivedAt":"2007-05-26T19:47:56Z","isPatch":false,"sender":{"key":"hanwen@google.com","avatar":"https://avatars.githubusercontent.com/u/31547?v=4"},"body":"Junio C Hamano escreveu:\n> And the reason it is \"insane\" is the same as why we currently do\n> not interpret \"git pull $repo origin/master\" as a request to\n> pull from remotes/origin/master.  It really is none of your\n> business what kind of remote branches the other end is\n> interacting with.\n\nfair enough; my remaining gripe is that the error message is broken.\nMy suggestion is to have  \n\n  git fetch . XXX\n\n(and by extension: pull) print something like\n\n  Will not fetch from self. \n  Do you mean \"git merge XXX\" or \"git update-ref XXX\" ? \n\nIt may be an artificial restriction when compared to \"git pull $dir XXX\" \nbut I think it helps the user better than \"Fetch failure\".\n\n-- \n Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen\n"}]}