{"thread":{"id":"34537","subject":"Why can't I push from a shallow clone?","startedAt":"2013-07-26T02:33:16Z","lastAt":"2013-07-26T21:48:12Z","messageCount":5,"participants":["Gulshan Singh","Fredrik Gustafsson","Konstantin Khomoutov","Philip Oakley"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"224100","messageId":"CANEZYrdsCgH+3NnZnnmsn_znt=+01aNn02u4mWyb3td9XypUog@mail.gmail.com","threadId":"34537","inReplyTo":null,"subject":"Why can't I push from a shallow clone?","fromName":"Gulshan Singh","fromEmail":"gsingh2011@gmail.com","sentAt":"2013-07-26T02:33:16Z","receivedAt":"2013-07-26T02:33:16Z","isPatch":false,"sender":{"key":"gsingh2011@gmail.com","avatar":null},"body":"I've been trying to figure out why I can't push from a shallow clone\n(using --depth) to a repository. I've made simple examples where it\nworks, but I've read that in doesn't work in every case. However, I\ncan't come up with a case where it doesn't work. Googling gives this\nanswer: http://stackoverflow.com/questions/6900103/why-cant-i-push-from-a-shallow-clone,\nbut I don't completely understand the explanation, so I was hoping\nsomeone could explain it.\n"},{"id":"224111","messageId":"20130726065528.GA4940@paksenarrion.iveqy.com","threadId":"34537","inReplyTo":"CANEZYrdsCgH+3NnZnnmsn_znt=+01aNn02u4mWyb3td9XypUog@mail.gmail.com","subject":"Re: Why can't I push from a shallow clone?","fromName":"Fredrik Gustafsson","fromEmail":"iveqy@iveqy.com","sentAt":"2013-07-26T06:55:28Z","receivedAt":"2013-07-26T06:55:28Z","isPatch":false,"sender":{"key":"iveqy@iveqy.com","avatar":"https://avatars.githubusercontent.com/u/761743?v=4"},"body":"On Thu, Jul 25, 2013 at 07:33:16PM -0700, Gulshan Singh wrote:\n> I've been trying to figure out why I can't push from a shallow clone\n> (using --depth) to a repository. I've made simple examples where it\n> works, but I've read that in doesn't work in every case. However, I\n> can't come up with a case where it doesn't work. Googling gives this\n> answer: http://stackoverflow.com/questions/6900103/why-cant-i-push-from-a-shallow-clone,\n> but I don't completely understand the explanation, so I was hoping\n> someone could explain it.\n\nI can't explain it better than what Junio did in the link you just\nprovide. However there's ongoing work to allow shallow clones to be able\nto push. You can read about it here:\nhttp://thread.gmane.org/gmane.comp.version-control.git/230612/focus=230878\n\n-- \nMed vänliga hälsningar\nFredrik Gustafsson\n\ntel: 0733-608274\ne-post: iveqy@iveqy.com\n"},{"id":"224116","messageId":"20130726133852.f1f9a1cc9c9207e5bbb74013@domain007.com","threadId":"34537","inReplyTo":"CANEZYrdsCgH+3NnZnnmsn_znt=+01aNn02u4mWyb3td9XypUog@mail.gmail.com","subject":"Re: Why can't I push from a shallow clone?","fromName":"Konstantin Khomoutov","fromEmail":"flatworm@users.sourceforge.net","sentAt":"2013-07-26T09:38:52Z","receivedAt":"2013-07-26T09:38:52Z","isPatch":false,"sender":{"key":"flatworm@users.sourceforge.net","avatar":null},"body":"On Thu, 25 Jul 2013 19:33:16 -0700\nGulshan Singh <gsingh2011@gmail.com> wrote:\n\n> I've been trying to figure out why I can't push from a shallow clone\n> (using --depth) to a repository. I've made simple examples where it\n> works, but I've read that in doesn't work in every case. However, I\n> can't come up with a case where it doesn't work. Googling gives this\n> answer:\n> http://stackoverflow.com/questions/6900103/why-cant-i-push-from-a-shallow-clone,\n> but I don't completely understand the explanation, so I was hoping\n> someone could explain it.\n\nSee also this thread [1] which originated from this SO question [2].\n\n1. http://thread.gmane.org/gmane.comp.version-control.git/221634\n2. http://stackoverflow.com/q/16077691/720999\n"},{"id":"224138","messageId":"CANEZYrdR3xLRSQAo6rroN3TLv48HEKp4_t95WEf6rm8-+r+2tw@mail.gmail.com","threadId":"34537","inReplyTo":"20130726065528.GA4940@paksenarrion.iveqy.com","subject":"Re: Why can't I push from a shallow clone?","fromName":"Gulshan Singh","fromEmail":"gsingh2011@gmail.com","sentAt":"2013-07-26T19:12:04Z","receivedAt":"2013-07-26T19:12:04Z","isPatch":false,"sender":{"key":"gsingh2011@gmail.com","avatar":null},"body":"Hey Fredrick,\n\nIt's good to know that work is being done on this. I still want to\nunderstand it though, so I guess I'll ask specific questions about\nJunio's response. He states,\n\n\"If you cloned shallowly some time ago, worked without communicating\nwith the other side while the other side progressed, AND if the other\nside's progress included a rewind & rebuild of the history, you would\nsee a similar topology.\nThe leftmost 'S' in the above picture might have been the tip of the\nbranch when you shallowly cloned with depth 1, and since then the\nremote end may have discarded topmost three commits and have rebuilt\nits history that leads to the rightmost 'R'. In such a case pushing to\nthe remote's HEAD will fail.\"\n\nSo as an example, if you shallow clone a branch, then someone squashes\nthe head commit and makes a new commit, you won't be able to push to\nHEAD because the parent has changed. But if someone does that, I don't\nthink you would be able to push even if it was a full clone. That's\nwhy it's usually not a good idea to rebase shared branches. So did I\nmisunderstand the scenario?\n\n\nOn Thu, Jul 25, 2013 at 11:55 PM, Fredrik Gustafsson <iveqy@iveqy.com> wrote:\n> On Thu, Jul 25, 2013 at 07:33:16PM -0700, Gulshan Singh wrote:\n>> I've been trying to figure out why I can't push from a shallow clone\n>> (using --depth) to a repository. I've made simple examples where it\n>> works, but I've read that in doesn't work in every case. However, I\n>> can't come up with a case where it doesn't work. Googling gives this\n>> answer: http://stackoverflow.com/questions/6900103/why-cant-i-push-from-a-shallow-clone,\n>> but I don't completely understand the explanation, so I was hoping\n>> someone could explain it.\n>\n> I can't explain it better than what Junio did in the link you just\n> provide. However there's ongoing work to allow shallow clones to be able\n> to push. You can read about it here:\n> http://thread.gmane.org/gmane.comp.version-control.git/230612/focus=230878\n>\n> --\n> Med vänliga hälsningar\n> Fredrik Gustafsson\n>\n> tel: 0733-608274\n> e-post: iveqy@iveqy.com\n\n\n\n-- \nGulshan Singh\nUniversity of Michigan, Class of 2015\nCollege of Engineering, Computer Science Major\ngulshan@umich.edu | 248.961.6317\nAlternate E-mail: gsingh2011@gmail.com\n"},{"id":"224150","messageId":"34D78815D927482897856F1C5BB2D183@PhilipOakley","threadId":"34537","inReplyTo":"CANEZYrdR3xLRSQAo6rroN3TLv48HEKp4_t95WEf6rm8-+r+2tw@mail.gmail.com","subject":"Re: Why can't I push from a shallow clone?","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2013-07-26T21:48:12Z","receivedAt":"2013-07-26T21:48:12Z","isPatch":false,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"From: \"Gulshan Singh\" <gsingh2011@gmail.com>\nSent: Friday, July 26, 2013 8:12 PM\n> Hey Fredrick,\n>\n> It's good to know that work is being done on this. I still want to\n> understand it though, so I guess I'll ask specific questions about\n> Junio's response. He states,\n>\n> \"If you cloned shallowly some time ago, worked without communicating\n> with the other side while the other side progressed, AND if the other\n> side's progress included a rewind & rebuild of the history, you would\n> see a similar topology.\n> The leftmost 'S' in the above picture might have been the tip of the\n> branch when you shallowly cloned with depth 1, and since then the\n> remote end may have discarded topmost three commits and have rebuilt\n> its history that leads to the rightmost 'R'. In such a case pushing to\n> the remote's HEAD will fail.\"\n>\n> So as an example, if you shallow clone a branch, then someone squashes\n> the head commit and makes a new commit, you won't be able to push to\n> HEAD because the parent has changed. But if someone does that, I don't\n> think you would be able to push even if it was a full clone. That's\n> why it's usually not a good idea to rebase shared branches. So did I\n> misunderstand the scenario?\n\nIn your example you have a sucessful failure, that is, the shallow issue \nhasn't got in the way of the normal non-ff failure on push. (asuming the \nsquash is an extra commit, not a re-written top commit, so at least you \nstill have your common commit of your depth1 shallow clone)\n\nFor it to be a proper shallow failure the remote repo needs to be \nre-written sufficiently far back that your shallow clone has nothing in \ncommon with it. In such a case your DAG can't join onto the remote's \nDAG.\n\n>\n>\n> On Thu, Jul 25, 2013 at 11:55 PM, Fredrik Gustafsson <iveqy@iveqy.com> \n> wrote:\n>> On Thu, Jul 25, 2013 at 07:33:16PM -0700, Gulshan Singh wrote:\n>>> I've been trying to figure out why I can't push from a shallow clone\n>>> (using --depth) to a repository. I've made simple examples where it\n>>> works, but I've read that in doesn't work in every case. However, I\n>>> can't come up with a case where it doesn't work. Googling gives this\n>>> answer: \n>>> http://stackoverflow.com/questions/6900103/why-cant-i-push-from-a-shallow-clone,\n>>> but I don't completely understand the explanation, so I was hoping\n>>> someone could explain it.\n>>\n>> I can't explain it better than what Junio did in the link you just\n>> provide. However there's ongoing work to allow shallow clones to be \n>> able\n>> to push. You can read about it here:\n>> http://thread.gmane.org/gmane.comp.version-control.git/230612/focus=230878\n>> --\n>> Med vänliga hälsningar\n>> Fredrik Gustafsson\n>> tel: 0733-608274\n>> e-post: iveqy@iveqy.com\n> -- \n> Gulshan Singh\n> University of Michigan, Class of 2015\n> College of Engineering, Computer Science Major\n> gulshan@umich.edu | 248.961.6317\n> Alternate E-mail: gsingh2011@gmail.com\n--\nPhilip \n"}]}