{"thread":{"id":"31012","subject":"git cloning paths","startedAt":"2012-07-12T22:17:09Z","lastAt":"2012-07-25T15:22:07Z","messageCount":3,"participants":["Douglas Garstang","Jeff King","Caleb Marchent"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"194990","messageId":"CANmEAK_jGdzR9R=0DexC+-_0U6mb_7o_v5zSKTuhgoaYCaSiFQ@mail.gmail.com","threadId":"31012","inReplyTo":null,"subject":"git cloning paths","fromName":"Douglas Garstang","fromEmail":"doug.garstang@gmail.com","sentAt":"2012-07-12T22:17:09Z","receivedAt":"2012-07-12T22:17:09Z","isPatch":false,"sender":{"key":"doug.garstang@gmail.com","avatar":null},"body":"All,\n\nI'm a relative newcomer to git and I've just inherited a setup where\nall of the company's code is in a single git repository. Within this\nrepository are multiple projects. It seems that git doesn't natively\nallow cloning/checking out of individual paths within the repo (ie\nprojects), which would seem to make integrating git with a continuous\nbuild system rather difficult. That is, the build system has to clone\nthe entire repo, and therefore a change to any project will result in\nthe entire contents of the repo being built.\n\nCorrect....?\n\nDoug.\n"},{"id":"194998","messageId":"20120713080731.GA32303@sigill.intra.peff.net","threadId":"31012","inReplyTo":"CANmEAK_jGdzR9R=0DexC+-_0U6mb_7o_v5zSKTuhgoaYCaSiFQ@mail.gmail.com","subject":"Re: git cloning paths","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-07-13T08:07:31Z","receivedAt":"2012-07-13T08:07:31Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jul 12, 2012 at 03:17:09PM -0700, Douglas Garstang wrote:\n\n> I'm a relative newcomer to git and I've just inherited a setup where\n> all of the company's code is in a single git repository. Within this\n> repository are multiple projects. It seems that git doesn't natively\n> allow cloning/checking out of individual paths within the repo (ie\n> projects), which would seem to make integrating git with a continuous\n> build system rather difficult. That is, the build system has to clone\n> the entire repo, and therefore a change to any project will result in\n> the entire contents of the repo being built.\n> \n> Correct....?\n\nYes. The feature you are looking for is either \"sparse checkout\" (only\ncheck out a subset of the files in the repository databse to the working\ntree) or \"sparse clone\" (only copy a subset of the files into the local\nrepository database during clone). Git v1.7.0 and later has sparse\ncheckout (see the \"sparse checkout\" section in \"git help read-tree\").\nThere is no implementation for sparse clone (and not likely to be one\nany time soon, as it introduces a lot of complexity into the object\nnegotiation phase).\n\nThe usual advice is that you should break up your big repository into\nlogical projects. You can do so with git-filter-branch, but beware that\nthis involves rewriting history, which means a flag day for everybody\nswitching to the new history (or dealing with migrating commits from the\nold history to the new history via rebase).\n\nFinally, if you have a build system which is cloning repeatedly, you may\nwant to keep a repository on the build server all the time and just\nfetch the updates into it. This is much more efficient even if you do\nend up paring down your repository.\n\n-Peff\n"},{"id":"195756","messageId":"9C3609BEC91A814BB52DBF9C41F04D1E74D159A0@uk-swa-ex02","threadId":"31012","inReplyTo":"CANmEAK_jGdzR9R=0DexC+-_0U6mb_7o_v5zSKTuhgoaYCaSiFQ@mail.gmail.com","subject":"RE: git cloning paths","fromName":"Caleb Marchent","fromEmail":"cmarchent@aminocom.com","sentAt":"2012-07-25T15:22:07Z","receivedAt":"2012-07-25T15:22:07Z","isPatch":false,"sender":{"key":"cmarchent@aminocom.com","avatar":null},"body":"Hi Doug,\n\nThe method I have been using to achieve this is to create a wrapper script that does the following:\n\ngit clone -n                                   # clone, but don't checkout\ncd <repo name>                        \ngit config core.sparseCheckout true    # configure sparse-checkout on\n# echo the list of bits you want into .git/info/sparse-checkout\ngit checkout\n\nDo watch out though, the interpretation of the sparse-checkout file has changed since git 1.7, I would suggest you use the latest git and record the git version as a comment in top of the sparse checkout file, in case it changes again. \n\nI hope this helps,\n\nCaleb\n\n-----Original Message-----\nFrom: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org] On Behalf Of Douglas Garstang\nSent: 12 July 2012 23:17\nTo: git@vger.kernel.org\nSubject: git cloning paths\n\nAll,\n\nI'm a relative newcomer to git and I've just inherited a setup where all of the company's code is in a single git repository. Within this repository are multiple projects. It seems that git doesn't natively allow cloning/checking out of individual paths within the repo (ie projects), which would seem to make integrating git with a continuous build system rather difficult. That is, the build system has to clone the entire repo, and therefore a change to any project will result in the entire contents of the repo being built.\n\nCorrect....?\n\nDoug.\n--\nTo unsubscribe from this list: send the line \"unsubscribe git\" in the body of a message to majordomo@vger.kernel.org More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"}]}