{"thread":{"id":"33535","subject":"Pushing/fetching from/into a shallow-cloned repository","startedAt":"2013-04-18T09:52:33Z","lastAt":"2013-04-19T16:02:34Z","messageCount":6,"participants":["Konstantin Khomoutov","Philip Oakley","Junio C Hamano","Duy Nguyen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"214702","messageId":"20130418135233.87aa23896fa48dc2d87d80fb@domain007.com","threadId":"33535","inReplyTo":null,"subject":"Pushing/fetching from/into a shallow-cloned repository","fromName":"Konstantin Khomoutov","fromEmail":"kostix+git@007spb.ru","sentAt":"2013-04-18T09:52:33Z","receivedAt":"2013-04-18T09:52:33Z","isPatch":false,"sender":{"key":"kostix+git@007spb.ru","avatar":null},"body":"The git-clone manual page, both [1] and my local copy coming with\nGit for Windows 1.8.1, say about the --depth command-line option:\n\n   --depth <depth>\n\n     Create a shallow clone with a history truncated to the specified\n     number of revisions. A shallow repository has a number of\n     limitations (you cannot clone or fetch from it, nor push from nor\n     into it), but is adequate if you are only interested in the recent\n     history of a large project with a long history, and would want to\n     send in fixes as patches.\n\nBut having done a shallow clone (--depth=1) of one of my repositories,\nI was able to record a new commit, push it out to a \"reference\" bare\nrepository and then fetch back to another clone of the same repository\njust fine.  I have then killed my test commit doing a forced push from\nanother clone and subsequently was able to do `git fetch` in my shallow\nclone just fine.\n\nSo I observe pushing/fetching works OK at least for a simple case like\nthis one.\n\nHence I'd like to ask: if the manual page is wrong or I'm observing\nsome corner case?\n"},{"id":"214704","messageId":"20130418135955.d9a824a157e347a3270f3210@domain007.com","threadId":"33535","inReplyTo":"20130418135233.87aa23896fa48dc2d87d80fb@domain007.com","subject":"Re: Pushing/fetching from/into a shallow-cloned repository","fromName":"Konstantin Khomoutov","fromEmail":"flatworm@users.sourceforge.net","sentAt":"2013-04-18T09:59:55Z","receivedAt":"2013-04-18T09:59:55Z","isPatch":false,"sender":{"key":"flatworm@users.sourceforge.net","avatar":null},"body":"On Thu, 18 Apr 2013 13:52:33 +0400\nKonstantin Khomoutov <kostix+git@007spb.ru> wrote:\n\n> The git-clone manual page, both [1] and my local copy coming with\n> Git for Windows 1.8.1, say about the --depth command-line option:\n\n[...]\n\nOops, by [1] I wanted to refer to this version:\nhttps://www.kernel.org/pub/software/scm/git/docs/git-clone.html\n"},{"id":"214759","messageId":"8BCCECD4CEEA4028AD97B851099F4C5E@PhilipOakley","threadId":"33535","inReplyTo":"20130418135233.87aa23896fa48dc2d87d80fb@domain007.com","subject":"Re: Pushing/fetching from/into a shallow-cloned repository","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2013-04-18T20:27:55Z","receivedAt":"2013-04-18T20:27:55Z","isPatch":false,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"From: \"Konstantin Khomoutov\" <kostix+git@007spb.ru>\nSent: Thursday, April 18, 2013 10:52 AM\n> The git-clone manual page, both [1] and my local copy coming with\n> Git for Windows 1.8.1, say about the --depth command-line option:\n>\n>   --depth <depth>\n>\n>     Create a shallow clone with a history truncated to the specified\n>     number of revisions. A shallow repository has a number of\n>     limitations (you cannot clone or fetch from it, nor push from nor\n>     into it), but is adequate if you are only interested in the recent\n>     history of a large project with a long history, and would want to\n>     send in fixes as patches.\n>\n> But having done a shallow clone (--depth=1) of one of my repositories,\n> I was able to record a new commit, push it out to a \"reference\" bare\n> repository and then fetch back to another clone of the same repository\n> just fine.  I have then killed my test commit doing a forced push from\n> another clone and subsequently was able to do `git fetch` in my \n> shallow\n> clone just fine.\n>\n> So I observe pushing/fetching works OK at least for a simple case like\n> this one.\n>\n> Hence I'd like to ask: if the manual page is wrong or I'm observing\n> some corner case?\n> --\nThe manual is deliberately misleading.\nThe problem is that the depth is a movable feast that depends on how far \nthe branches have progressed.\nThe DAG will be missing the historic merge bases, and in some scenarios \ncan form disconnected runs of commits. The ref negotiation can also be a \nproblem.\n\nThe git\\Documentation\\technical\\shallow.txt has some extra details on \nissues.\n\nPhilip\n"},{"id":"214768","messageId":"7vbo9b4fuz.fsf@alter.siamese.dyndns.org","threadId":"33535","inReplyTo":"8BCCECD4CEEA4028AD97B851099F4C5E@PhilipOakley","subject":"Re: Pushing/fetching from/into a shallow-cloned repository","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-04-18T22:46:12Z","receivedAt":"2013-04-18T22:46:12Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Philip Oakley\" <philipoakley@iee.org> writes:\n\n>> So I observe pushing/fetching works OK at least for a simple case like\n>> this one.\n>>\n>> Hence I'd like to ask: if the manual page is wrong or I'm observing\n>> some corner case?\n>> --\n> The manual is deliberately misleading.\n\nYes, it is erring on the safe side.\n\nIt was not coded with the case where the gap widens (e.g. either\nside rewinds the history) in mind as you explained; for simple cases\nthe code just happens to work, but the users are encouraged not to\nrely on it to be safe than sorry.\n"},{"id":"214824","messageId":"CACsJy8DUZYuGO=4WL-uyszxvhvwyuz4=SvW6O0O+5O+XZUfDmg@mail.gmail.com","threadId":"33535","inReplyTo":"8BCCECD4CEEA4028AD97B851099F4C5E@PhilipOakley","subject":"Re: Pushing/fetching from/into a shallow-cloned repository","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2013-04-19T11:22:00Z","receivedAt":"2013-04-19T11:22:00Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Fri, Apr 19, 2013 at 6:27 AM, Philip Oakley <philipoakley@iee.org> wrote:\n> From: \"Konstantin Khomoutov\" <kostix+git@007spb.ru>\n>> So I observe pushing/fetching works OK at least for a simple case like\n>> this one.\n>>\n>> Hence I'd like to ask: if the manual page is wrong or I'm observing\n>> some corner case?\n>> --\n>\n> The manual is deliberately misleading.\n> The problem is that the depth is a movable feast that depends on how far the\n> branches have progressed.\n> The DAG will be missing the historic merge bases, and in some scenarios can\n> form disconnected runs of commits. The ref negotiation can also be a\n> problem.\n>\n> The git\\Documentation\\technical\\shallow.txt has some extra details on\n> issues.\n\nWith recent improvements in index-pack, I think we can be certain that\nall gaps are caught. So either it works or it does not. It cannot lead\nto an incomplete repository. At least for git and smart http\ntransports. So I'm inclined to lift the limitation for these\ntransports. Missing merge bases remains a limitation the user should\nbe aware of, of course.\n--\nDuy\n"},{"id":"214833","messageId":"20130419200234.215de8c7b5dc7510025847b9@domain007.com","threadId":"33535","inReplyTo":"7vbo9b4fuz.fsf@alter.siamese.dyndns.org","subject":"Re: Pushing/fetching from/into a shallow-cloned repository","fromName":"Konstantin Khomoutov","fromEmail":"flatworm@users.sourceforge.net","sentAt":"2013-04-19T16:02:34Z","receivedAt":"2013-04-19T16:02:34Z","isPatch":false,"sender":{"key":"flatworm@users.sourceforge.net","avatar":null},"body":"On Thu, 18 Apr 2013 15:46:12 -0700\nJunio C Hamano <gitster@pobox.com> wrote:\n\n> \"Philip Oakley\" <philipoakley@iee.org> writes:\n> \n> >> So I observe pushing/fetching works OK at least for a simple case\n> >> like this one.\n> >>\n> >> Hence I'd like to ask: if the manual page is wrong or I'm observing\n> >> some corner case?\n> >> --\n> > The manual is deliberately misleading.\n> \n> Yes, it is erring on the safe side.\n> \n> It was not coded with the case where the gap widens (e.g. either\n> side rewinds the history) in mind as you explained; for simple cases\n> the code just happens to work, but the users are encouraged not to\n> rely on it to be safe than sorry.\n\nWell, actually my question arouse during the discussion which followed\nby this SO question [1] where someone asked if it's possible to update\njust one file in a remote repository without cloning it first (a-la\nSubversion, that is).  While I perfectly understand that Git data model\ndoes not support such \"server-side commits\" I'm able to envision a case\nwhen, say, a developer is asked to perform some minor tweak to the code\nwhile they're in a situation with no repository clone at hand and only a\ncrappy/costly cellular link available for communication.  I think\nshallow cloning might be a palliative solution to this kind of problem\n(a one-off clone/edit/commit/push session).\n\nTaking into account what Duy Nguyen said on this topic, it seems that\nthat description of the shallow cloning in the git-clone manual page\ncould supposedly be made somewhat less denying about what could be done\nusing a shallow clone.  May be a note that such a setup could be okay\nfor very simple things like clone/edit/push would be just enough?\n\n1. http://stackoverflow.com/q/16077691/720999\n"}]}