* Why can't I push from a shallow clone? @ 2013-07-26 2:33 Gulshan Singh 2013-07-26 6:55 ` Fredrik Gustafsson 2013-07-26 9:38 ` Konstantin Khomoutov 0 siblings, 2 replies; 5+ messages in thread From: Gulshan Singh @ 2013-07-26 2:33 UTC (permalink / raw) To: git I've been trying to figure out why I can't push from a shallow clone (using --depth) to a repository. I've made simple examples where it works, but I've read that in doesn't work in every case. However, I can't come up with a case where it doesn't work. Googling gives this answer: http://stackoverflow.com/questions/6900103/why-cant-i-push-from-a-shallow-clone, but I don't completely understand the explanation, so I was hoping someone could explain it. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Why can't I push from a shallow clone? 2013-07-26 2:33 Why can't I push from a shallow clone? Gulshan Singh @ 2013-07-26 6:55 ` Fredrik Gustafsson 2013-07-26 19:12 ` Gulshan Singh 2013-07-26 9:38 ` Konstantin Khomoutov 1 sibling, 1 reply; 5+ messages in thread From: Fredrik Gustafsson @ 2013-07-26 6:55 UTC (permalink / raw) To: Gulshan Singh; +Cc: git On Thu, Jul 25, 2013 at 07:33:16PM -0700, Gulshan Singh wrote: > I've been trying to figure out why I can't push from a shallow clone > (using --depth) to a repository. I've made simple examples where it > works, but I've read that in doesn't work in every case. However, I > can't come up with a case where it doesn't work. Googling gives this > answer: http://stackoverflow.com/questions/6900103/why-cant-i-push-from-a-shallow-clone, > but I don't completely understand the explanation, so I was hoping > someone could explain it. I can't explain it better than what Junio did in the link you just provide. However there's ongoing work to allow shallow clones to be able to push. You can read about it here: http://thread.gmane.org/gmane.comp.version-control.git/230612/focus=230878 -- Med vänliga hälsningar Fredrik Gustafsson tel: 0733-608274 e-post: iveqy@iveqy.com ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Why can't I push from a shallow clone? 2013-07-26 6:55 ` Fredrik Gustafsson @ 2013-07-26 19:12 ` Gulshan Singh 2013-07-26 21:48 ` Philip Oakley 0 siblings, 1 reply; 5+ messages in thread From: Gulshan Singh @ 2013-07-26 19:12 UTC (permalink / raw) To: Fredrik Gustafsson; +Cc: git Hey Fredrick, It's good to know that work is being done on this. I still want to understand it though, so I guess I'll ask specific questions about Junio's response. He states, "If you cloned shallowly some time ago, worked without communicating with the other side while the other side progressed, AND if the other side's progress included a rewind & rebuild of the history, you would see a similar topology. The leftmost 'S' in the above picture might have been the tip of the branch when you shallowly cloned with depth 1, and since then the remote end may have discarded topmost three commits and have rebuilt its history that leads to the rightmost 'R'. In such a case pushing to the remote's HEAD will fail." So as an example, if you shallow clone a branch, then someone squashes the head commit and makes a new commit, you won't be able to push to HEAD because the parent has changed. But if someone does that, I don't think you would be able to push even if it was a full clone. That's why it's usually not a good idea to rebase shared branches. So did I misunderstand the scenario? On Thu, Jul 25, 2013 at 11:55 PM, Fredrik Gustafsson <iveqy@iveqy.com> wrote: > On Thu, Jul 25, 2013 at 07:33:16PM -0700, Gulshan Singh wrote: >> I've been trying to figure out why I can't push from a shallow clone >> (using --depth) to a repository. I've made simple examples where it >> works, but I've read that in doesn't work in every case. However, I >> can't come up with a case where it doesn't work. Googling gives this >> answer: http://stackoverflow.com/questions/6900103/why-cant-i-push-from-a-shallow-clone, >> but I don't completely understand the explanation, so I was hoping >> someone could explain it. > > I can't explain it better than what Junio did in the link you just > provide. However there's ongoing work to allow shallow clones to be able > to push. You can read about it here: > http://thread.gmane.org/gmane.comp.version-control.git/230612/focus=230878 > > -- > Med vänliga hälsningar > Fredrik Gustafsson > > tel: 0733-608274 > e-post: iveqy@iveqy.com -- Gulshan Singh University of Michigan, Class of 2015 College of Engineering, Computer Science Major gulshan@umich.edu | 248.961.6317 Alternate E-mail: gsingh2011@gmail.com ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Why can't I push from a shallow clone? 2013-07-26 19:12 ` Gulshan Singh @ 2013-07-26 21:48 ` Philip Oakley 0 siblings, 0 replies; 5+ messages in thread From: Philip Oakley @ 2013-07-26 21:48 UTC (permalink / raw) To: Gulshan Singh, Fredrik Gustafsson; +Cc: git From: "Gulshan Singh" <gsingh2011@gmail.com> Sent: Friday, July 26, 2013 8:12 PM > Hey Fredrick, > > It's good to know that work is being done on this. I still want to > understand it though, so I guess I'll ask specific questions about > Junio's response. He states, > > "If you cloned shallowly some time ago, worked without communicating > with the other side while the other side progressed, AND if the other > side's progress included a rewind & rebuild of the history, you would > see a similar topology. > The leftmost 'S' in the above picture might have been the tip of the > branch when you shallowly cloned with depth 1, and since then the > remote end may have discarded topmost three commits and have rebuilt > its history that leads to the rightmost 'R'. In such a case pushing to > the remote's HEAD will fail." > > So as an example, if you shallow clone a branch, then someone squashes > the head commit and makes a new commit, you won't be able to push to > HEAD because the parent has changed. But if someone does that, I don't > think you would be able to push even if it was a full clone. That's > why it's usually not a good idea to rebase shared branches. So did I > misunderstand the scenario? In your example you have a sucessful failure, that is, the shallow issue hasn't got in the way of the normal non-ff failure on push. (asuming the squash is an extra commit, not a re-written top commit, so at least you still have your common commit of your depth1 shallow clone) For it to be a proper shallow failure the remote repo needs to be re-written sufficiently far back that your shallow clone has nothing in common with it. In such a case your DAG can't join onto the remote's DAG. > > > On Thu, Jul 25, 2013 at 11:55 PM, Fredrik Gustafsson <iveqy@iveqy.com> > wrote: >> On Thu, Jul 25, 2013 at 07:33:16PM -0700, Gulshan Singh wrote: >>> I've been trying to figure out why I can't push from a shallow clone >>> (using --depth) to a repository. I've made simple examples where it >>> works, but I've read that in doesn't work in every case. However, I >>> can't come up with a case where it doesn't work. Googling gives this >>> answer: >>> http://stackoverflow.com/questions/6900103/why-cant-i-push-from-a-shallow-clone, >>> but I don't completely understand the explanation, so I was hoping >>> someone could explain it. >> >> I can't explain it better than what Junio did in the link you just >> provide. However there's ongoing work to allow shallow clones to be >> able >> to push. You can read about it here: >> http://thread.gmane.org/gmane.comp.version-control.git/230612/focus=230878 >> -- >> Med vänliga hälsningar >> Fredrik Gustafsson >> tel: 0733-608274 >> e-post: iveqy@iveqy.com > -- > Gulshan Singh > University of Michigan, Class of 2015 > College of Engineering, Computer Science Major > gulshan@umich.edu | 248.961.6317 > Alternate E-mail: gsingh2011@gmail.com -- Philip ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Why can't I push from a shallow clone? 2013-07-26 2:33 Why can't I push from a shallow clone? Gulshan Singh 2013-07-26 6:55 ` Fredrik Gustafsson @ 2013-07-26 9:38 ` Konstantin Khomoutov 1 sibling, 0 replies; 5+ messages in thread From: Konstantin Khomoutov @ 2013-07-26 9:38 UTC (permalink / raw) To: Gulshan Singh; +Cc: git On Thu, 25 Jul 2013 19:33:16 -0700 Gulshan Singh <gsingh2011@gmail.com> wrote: > I've been trying to figure out why I can't push from a shallow clone > (using --depth) to a repository. I've made simple examples where it > works, but I've read that in doesn't work in every case. However, I > can't come up with a case where it doesn't work. Googling gives this > answer: > http://stackoverflow.com/questions/6900103/why-cant-i-push-from-a-shallow-clone, > but I don't completely understand the explanation, so I was hoping > someone could explain it. See also this thread [1] which originated from this SO question [2]. 1. http://thread.gmane.org/gmane.comp.version-control.git/221634 2. http://stackoverflow.com/q/16077691/720999 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-07-26 21:47 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-07-26 2:33 Why can't I push from a shallow clone? Gulshan Singh 2013-07-26 6:55 ` Fredrik Gustafsson 2013-07-26 19:12 ` Gulshan Singh 2013-07-26 21:48 ` Philip Oakley 2013-07-26 9:38 ` Konstantin Khomoutov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).