{"thread":{"id":"17811","subject":"pushing from a shallow repo allowed?","startedAt":"2009-02-12T22:02:54Z","lastAt":"2009-03-05T00:41:25Z","messageCount":11,"participants":["Joey Hess","Mikael Magnusson","Adeodato Simó","Johannes Sixt","Jay Soffian","Junio C Hamano","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"104866","messageId":"20090212220254.GA1517@gnu.kitenet.net","threadId":"17811","inReplyTo":null,"subject":"pushing from a shallow repo allowed?","fromName":"Joey Hess","fromEmail":"joey@kitenet.net","sentAt":"2009-02-12T22:02:54Z","receivedAt":"2009-02-12T22:02:54Z","isPatch":false,"sender":{"key":"joey@kitenet.net","avatar":"https://avatars.githubusercontent.com/u/16392?v=4"},"body":"git-clone(1):\n\tA shallow repository has a number of\n        limitations (you cannot clone or fetch from it, nor push from nor\n        into it)\n\nThis and other documentation (shallow.txt, RelNotes-1.5.0.txt) says you\ncan't push from a shallow repo. But in a simple test of making a commit\nto a shallow repo and pushing it out, it seems to work. AFAICS, git only\nguards against pushes *into* a shallow repo, and fetching/cloning from a\nshallow repository.\n\nAre the docs out of date, or is there really still some problem\nwith pushing from a shallow repo?\n\n\nBTW, --depth seems to be ignored when making a local clone.\nThis seems to have been fixed in the old shell git-clone in\nd4110a9726c7cd5cda35b7dd03dc8f85fe3dff0c, was it accidentially lost\nin the C version?\n\njoey@gnu:~/src/other> git clone --depth 2 git git.shallow\nInitialized empty Git repository in /home/joey/src/other/git.shallow/.git/\njoey@gnu:~/src/other> cd git.shallow \njoey@gnu:~/src/other/git.shallow> git-log --pretty=oneline|wc -l\n17009\n\ngit version 1.5.6.5\n\n-- \nsee shy jo\n"},{"id":"104922","messageId":"237967ef0902160200r2320687ai71e62047c3ead9ad@mail.gmail.com","threadId":"17811","inReplyTo":"20090212220254.GA1517@gnu.kitenet.net","subject":"Re: pushing from a shallow repo allowed?","fromName":"Mikael Magnusson","fromEmail":"mikachu@gmail.com","sentAt":"2009-02-16T10:00:21Z","receivedAt":"2009-02-16T10:00:21Z","isPatch":false,"sender":{"key":"mikachu@gmail.com","avatar":null},"body":"2009/2/12 Joey Hess <joey@kitenet.net>:\n> git-clone(1):\n>        A shallow repository has a number of\n>        limitations (you cannot clone or fetch from it, nor push from nor\n>        into it)\n>\n> This and other documentation (shallow.txt, RelNotes-1.5.0.txt) says you\n> can't push from a shallow repo. But in a simple test of making a commit\n> to a shallow repo and pushing it out, it seems to work. AFAICS, git only\n> guards against pushes *into* a shallow repo, and fetching/cloning from a\n> shallow repository.\n>\n> Are the docs out of date, or is there really still some problem\n> with pushing from a shallow repo?\n\nAFAIK, it will work in simple cases, but isn't guaranteed to work.\n\n> BTW, --depth seems to be ignored when making a local clone.\n> This seems to have been fixed in the old shell git-clone in\n> d4110a9726c7cd5cda35b7dd03dc8f85fe3dff0c, was it accidentially lost\n> in the C version?\n>\n> joey@gnu:~/src/other> git clone --depth 2 git git.shallow\n> Initialized empty Git repository in /home/joey/src/other/git.shallow/.git/\n> joey@gnu:~/src/other> cd git.shallow\n> joey@gnu:~/src/other/git.shallow> git-log --pretty=oneline|wc -l\n> 17009\n>\n> git version 1.5.6.5\n\nYou most likely need to use the file:// syntax for this to work,\notherwise git will just hardlink/copy the whole objects dir without\nlooking at it.\n\n-- \nMikael Magnusson\n"},{"id":"106820","messageId":"1236080017-13987-1-git-send-email-dato@net.com.org.es","threadId":"17811","inReplyTo":"237967ef0902160200r2320687ai71e62047c3ead9ad@mail.gmail.com","subject":"[PATCH] git-clone.txt: document that pushing from a shallow clone may work","fromName":"Adeodato Simó","fromEmail":"dato@net.com.org.es","sentAt":"2009-03-03T11:33:37Z","receivedAt":"2009-03-03T11:33:37Z","isPatch":true,"sender":{"key":"dato@net.com.org.es","avatar":"https://gravatar.com/avatar/952ec7d5d5663eb8baf631b5c37f9c58480a881920dd5f8a2d3a71f969b72b53?d=mp&s=160"},"body":"The documentation used to say that pushing from a shallow clone is not\nsupported; this is true, though it may work in some simple cases. If a\nuser notices this fact, such a mismatch between documentation and reality\nmay leave them assuming the documentation is wrong and that pushing from\na shallow clone is supported.\n\nThis commit updates the documentation to say that pushing from a shallow\nclone may work in some cases, but that it's not guaranteed to always do.\n\nSigned-off-by: Adeodato Simó <dato@net.com.org.es>\n---\nHello,\n\nthis is about http://thread.gmane.org/gmane.comp.version-control.git/110100,\nwhich got a single reply from Mikael Magnusson stating:\n\n> AFAIK, it will work in simple cases, but isn't guaranteed to work.\n\nIf that's the case, I think it should be documented, for the reasons\nexplained in the commit message.\n\nThanks!\n\n Documentation/git-clone.txt |    6 ++++--\n 1 files changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt\nindex 95f08b9..1b4f864 100644\n--- a/Documentation/git-clone.txt\n+++ b/Documentation/git-clone.txt\n@@ -133,8 +133,10 @@ then the cloned repository will become corrupt.\n --depth <depth>::\n \tCreate a 'shallow' clone with a history truncated to the\n \tspecified number of revisions.  A shallow repository has a\n-\tnumber of limitations (you cannot clone or fetch from\n-\tit, nor push from nor into it), but is adequate if you\n+\tnumber of limitations: you cannot clone or fetch from it,\n+\tnor push into it; pushing from it into a regular repository\n+\tmay work correctly in some cases, but it is not guaranteed to\n+\talways work.  However, a shallow repository is adequate if you\n \tare only interested in the recent history of a large project\n \twith a long history, and would want to send in fixes\n \tas patches.\n-- \n1.6.2.rc2.271.ge939\n"},{"id":"106825","messageId":"49AD1B22.6050201@viscovery.net","threadId":"17811","inReplyTo":"1236080017-13987-1-git-send-email-dato@net.com.org.es","subject":"Re: [PATCH] git-clone.txt: document that pushing from a shallow clone may work","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-03-03T11:57:22Z","receivedAt":"2009-03-03T11:57:22Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Adeodato Simó schrieb:\n> @@ -133,8 +133,10 @@ then the cloned repository will become corrupt.\n>  --depth <depth>::\n>  \tCreate a 'shallow' clone with a history truncated to the\n>  \tspecified number of revisions.  A shallow repository has a\n> -\tnumber of limitations (you cannot clone or fetch from\n> -\tit, nor push from nor into it), but is adequate if you\n> +\tnumber of limitations: you cannot clone or fetch from it,\n> +\tnor push into it; pushing from it into a regular repository\n> +\tmay work correctly in some cases, but it is not guaranteed to\n> +\talways work.  However, a shallow repository is adequate if you\n\nConsider a reader who wants to decide whether --depth should or can be\nused in a git clone invocation. Is the new wording helpful? If you don't\ndescribe those \"some cases\" in more detail, then we better keep the\ncurrent wording.\n\n-- Hannes\n"},{"id":"106827","messageId":"20090303120856.GB15003@chistera.yi.org","threadId":"17811","inReplyTo":"49AD1B22.6050201@viscovery.net","subject":"Re: [PATCH] git-clone.txt: document that pushing from a shallow clone may work","fromName":"Adeodato Simó","fromEmail":"dato@net.com.org.es","sentAt":"2009-03-03T12:08:56Z","receivedAt":"2009-03-03T12:08:56Z","isPatch":true,"sender":{"key":"dato@net.com.org.es","avatar":"https://gravatar.com/avatar/952ec7d5d5663eb8baf631b5c37f9c58480a881920dd5f8a2d3a71f969b72b53?d=mp&s=160"},"body":"* Johannes Sixt [Tue, 03 Mar 2009 12:57:22 +0100]:\n\n> Adeodato Simó schrieb:\n> > @@ -133,8 +133,10 @@ then the cloned repository will become corrupt.\n> >  --depth <depth>::\n> >  \tCreate a 'shallow' clone with a history truncated to the\n> >  \tspecified number of revisions.  A shallow repository has a\n> > -\tnumber of limitations (you cannot clone or fetch from\n> > -\tit, nor push from nor into it), but is adequate if you\n> > +\tnumber of limitations: you cannot clone or fetch from it,\n> > +\tnor push into it; pushing from it into a regular repository\n> > +\tmay work correctly in some cases, but it is not guaranteed to\n> > +\talways work.  However, a shallow repository is adequate if you\n\n> Consider a reader who wants to decide whether --depth should or can be\n> used in a git clone invocation. Is the new wording helpful? If you don't\n> describe those \"some cases\" in more detail, then we better keep the\n> current wording.\n\nWell, I don't know if the set of cases where it'll work can be defined\nin detail to a point where it is useful. If it is, then sure, let's do\nit.\n\nMy point is that if it will work in some cases, then the documentation\nshould *acknowledge that fact*, because else people will assume the\ndocumentation is wrong, and believe it is intended to work, which is not\nthe case.\n\nI think doing that is very important, and I hope I'm explaining myself\nclearly.\n\nThanks,\n\n-- \nAdeodato Simó                                     dato at net.com.org.es\nDebian Developer                                  adeodato at debian.org\n \n«Ara que ets la meva dona, te la fotré fins a la melsa, bacona!»\n                -- Terenci Moix, “Chulas y famosas”\n"},{"id":"106915","messageId":"76718490903031127v7fcec124je7292c4c465208b8@mail.gmail.com","threadId":"17811","inReplyTo":"20090303120856.GB15003@chistera.yi.org","subject":"Re: [PATCH] git-clone.txt: document that pushing from a shallow clone may work","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-03-03T19:27:29Z","receivedAt":"2009-03-03T19:27:29Z","isPatch":true,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Tue, Mar 3, 2009 at 7:08 AM, Adeodato Simó <dato@net.com.org.es> wrote:\n> Well, I don't know if the set of cases where it'll work can be defined\n> in detail to a point where it is useful. If it is, then sure, let's do\n> it.\n>\n> My point is that if it will work in some cases, then the documentation\n> should *acknowledge that fact*, because else people will assume the\n> documentation is wrong, and believe it is intended to work, which is not\n> the case.\n\nWy not just say \"pushing into a shallow repository is not supported\"\ninstead of \"pushing into a shallow repository won't work.\"\n\nj.\n"},{"id":"106960","messageId":"20090304101939.GA7142@chistera.yi.org","threadId":"17811","inReplyTo":"76718490903031127v7fcec124je7292c4c465208b8@mail.gmail.com","subject":"Re: [PATCH] git-clone.txt: document that pushing from a shallow clone may work","fromName":"Adeodato Simó","fromEmail":"dato@net.com.org.es","sentAt":"2009-03-04T10:19:39Z","receivedAt":"2009-03-04T10:19:39Z","isPatch":true,"sender":{"key":"dato@net.com.org.es","avatar":"https://gravatar.com/avatar/952ec7d5d5663eb8baf631b5c37f9c58480a881920dd5f8a2d3a71f969b72b53?d=mp&s=160"},"body":"* Jay Soffian [Tue, 03 Mar 2009 14:27:29 -0500]:\n\n> On Tue, Mar 3, 2009 at 7:08 AM, Adeodato Simó <dato@net.com.org.es> wrote:\n> > Well, I don't know if the set of cases where it'll work can be defined\n> > in detail to a point where it is useful. If it is, then sure, let's do\n> > it.\n\n> > My point is that if it will work in some cases, then the documentation\n> > should *acknowledge that fact*, because else people will assume the\n> > documentation is wrong, and believe it is intended to work, which is not\n> > the case.\n\n> Wy not just say \"pushing into a shallow repository is not supported\"\n> instead of \"pushing into a shallow repository won't work.\"\n\nI don't think such a wording is enough (adjusted, of course, to be about\npushing from, not to, which is the case at hand).\n\nBut I'll try to stay silent, and see if Junio has an opinion on the\nmatter.\n\nThanks,\n\n-- \nAdeodato Simó                                     dato at net.com.org.es\nDebian Developer                                  adeodato at debian.org\n \n- Oh my God, you're pimping me out for a new roof?\n- And windows!\n                -- Andrew and Bree Van De Kamp\n"},{"id":"106964","messageId":"7vvdqp5zx9.fsf@gitster.siamese.dyndns.org","threadId":"17811","inReplyTo":"20090304101939.GA7142@chistera.yi.org","subject":"Re: [PATCH] git-clone.txt: document that pushing from a shallow clone may work","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-03-04T10:45:54Z","receivedAt":"2009-03-04T10:45:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Adeodato Simó <dato@net.com.org.es> writes:\n\n>> Wy not just say \"pushing into a shallow repository is not supported\"\n>> instead of \"pushing into a shallow repository won't work.\"\n>\n> I don't think such a wording is enough (adjusted, of course, to be about\n> pushing from, not to, which is the case at hand).\n>\n> But I'll try to stay silent, and see if Junio has an opinion on the\n> matter.\n\nI would be a terrible judge for things like this; I lost my git virginity\nlong time ago.\n\nIf I have to say something on this...\n\n * I think \"is not supported\" is a succinct way to give good enough\n   information, but it would only work for intelligent people.\n\n * Not everybody is intelligent; some try it out themselves, see that the\n   operation _seems to_ work for their limited number of trials, and would\n   conclude it would work most of the time.  And they congratulate their\n   own intelligence for saying \"most of the time\", not \"always\".  And they\n   get upset when they see it does not work, even though they have been\n   warned.\n\n * Hence, I do not think \"is not supported\" is a statement that is a bit\n   too weak.  At least you need to say \"it may seem to work, but no\n   guarantees\", _if_ your objective is to cover the backside of \"shallow\".\n\nBut I do not think that is what we should be aiming for to begin with.\n\nIt is not like nobody can precisely answer when \"pushing from shallow\"\nworks and when it doesn't.  It would be true for a hack that was not well\ndesigned but merely was meant to be \"good enough for most of the time\",\nbut I do not think \"shallow\" is that horrible a hack.\n\nIsn't the rule more or less like:\n\n    If your shallow repository's history does not extend long enough and\n    the other repository forked before your truncated history, wyou cannot\n    compute the common ancestor and you cannot push out.\n"},{"id":"106968","messageId":"alpine.DEB.1.00.0903041209070.8549@intel-tinevez-2-302","threadId":"17811","inReplyTo":"7vvdqp5zx9.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] git-clone.txt: document that pushing from a shallow clone may work","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-03-04T11:11:22Z","receivedAt":"2009-03-04T11:11:22Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 4 Mar 2009, Junio C Hamano wrote:\n\n> Isn't the rule more or less like:\n> \n>     If your shallow repository's history does not extend long enough and\n>     the other repository forked before your truncated history, wyou cannot\n>     compute the common ancestor and you cannot push out.\n\nExactly.\n\nBack when I wrote the shallow code, I meant to investigate how to detect \nthat condition, and fail gracefully (i.e. with a meaningful error \nmessage).\n\nIMHO that is more needed than documentation changes, as it affects more \nusers ;-)\n\nBut in the meantime, I had no use for shallow clones, and kind of hoped \nthat it would become somebody else's itch.\n\nCiao,\nDscho\n"},{"id":"107006","messageId":"20090304222224.GA20335@chistera.yi.org","threadId":"17811","inReplyTo":"7vvdqp5zx9.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] git-clone.txt: document that pushing from a shallow clone may work","fromName":"Adeodato Simó","fromEmail":"dato@net.com.org.es","sentAt":"2009-03-04T22:22:24Z","receivedAt":"2009-03-04T22:22:24Z","isPatch":true,"sender":{"key":"dato@net.com.org.es","avatar":"https://gravatar.com/avatar/952ec7d5d5663eb8baf631b5c37f9c58480a881920dd5f8a2d3a71f969b72b53?d=mp&s=160"},"body":"* Junio C Hamano [Wed, 04 Mar 2009 02:45:54 -0800]:\n\n> Isn't the rule more or less like:\n\n>     If your shallow repository's history does not extend long enough and\n>     the other repository forked before your truncated history, wyou cannot\n>     compute the common ancestor and you cannot push out.\n\nAh, this is helpful, thanks for it and for the rest of the message.\nWould you take a patch to include this in the git-clone manpage, maybe\nwith an alternative wording? Eg.:\n\n  Pushing from a shallow repository is not supported, but works when\n  you're pushing to branches with a common ancestor in your available\n  history (so pushing to the remote HEAD should always work).\n\nI *think* the sentence in brackets is correct; I put it there because in\nmy experience is a feature a lot of people around me want.(¹)\n\n  (¹) I realize this may seem odd, people with push access wanting to be\n  able to push from a shallow repository. In case somebody is interested\n  in the details, there's been discussion in the debian-python lists\n  about a possible move to Git. There currently exists a Subversion\n  repository with a lot of packages; many people with access just work\n  on a few of them, but do the typical random fix on others from time to\n  time. And some of them were concerned about downloading all history\n  for over a hundred of repositories. (Which was another of the\n  conflicting points, how it's very easy to download all the packages in\n  Subversion.)\n\nCheers,\n\n-- \nAdeodato Simó                                     dato at net.com.org.es\nDebian Developer                                  adeodato at debian.org\n \nMan is certainly stark mad; he cannot make a flea, yet he makes gods by the\ndozens.\n                -- Michel de Montaigne\n"},{"id":"107010","messageId":"7vr61c4x8q.fsf@gitster.siamese.dyndns.org","threadId":"17811","inReplyTo":"alpine.DEB.1.00.0903041209070.8549@intel-tinevez-2-302","subject":"Re: [PATCH] git-clone.txt: document that pushing from a shallow clone may work","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-03-05T00:41:25Z","receivedAt":"2009-03-05T00:41:25Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> On Wed, 4 Mar 2009, Junio C Hamano wrote:\n>\n>> Isn't the rule more or less like:\n>> \n>>     If your shallow repository's history does not extend long enough and\n>>     the other repository forked before your truncated history, wyou cannot\n>>     compute the common ancestor and you cannot push out.\n>\n> Exactly.\n\nActually, come to think of it, it is a lot stronger than \"cannot compute\nthe common\".\n\nThe history may look like this:\n\n          R---R---R\n         /\n  --R---R---X---X---S---S---S\n\nwhere S are the commits you have in your shallow repository, and R are the\ncommits that exist in the repository that receives your push.  Because\nyour history is shallow, neither repository has 'X' that are the commits\nthat need to exist in order to keep the history of recipient repository\ncomplete; the recipient is not shallow to begin with, and we do not want\nto make it shallow.\n\nIf you cloned shallowly some time ago, worked without communicating with\nthe other side while the other side progressed, *AND* if the other side's\nprogress included a rewind & rebuild of the history, you would see a\nsimilar topology.  The leftmost 'S' in the above picture might have been\nthe tip of the branch when you shallowly cloned with depth 1, and since\nthen the remote end may have discarded topmost three commits and have\nrebuilt its history that leads to the rightmost 'R'.  In such a case\npushing to the remote's HEAD will fail.\n"}]}