{"thread":{"id":"25658","subject":"Sparse checkouts","startedAt":"2010-11-07T02:04:06Z","lastAt":"2010-11-11T11:56:51Z","messageCount":3,"participants":["Uri Moszkowicz","Nguyen Thai Ngoc Duy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"155309","messageId":"loom.20101107T030122-536@post.gmane.org","threadId":"25658","inReplyTo":null,"subject":"Sparse checkouts","fromName":"Uri Moszkowicz","fromEmail":"uri@4refs.com","sentAt":"2010-11-07T02:04:06Z","receivedAt":"2010-11-07T02:04:06Z","isPatch":false,"sender":{"key":"uri@4refs.com","avatar":null},"body":"Hi,\nI'm working with a repository with a very large number of files and Git is \nappealing because it officially supports sparse checkouts unlike the other \nDVCS tools. However, all of the usage examples that I've come across have \nyou checkout the full repository and then prune the undesired files as such:\n\n  git clone <dir>\n  git config core.sparsecheckout true\n  echo \"<dir>/\" > .git/info/sparse-checkout\n  git read-tree -m -u HEAD\n\nI tried adding \"-n\" to the clone command but then none of the missing \ndirectories are checked out by read-tree. I can manually check them out \nand everything seems to work fine but I can also manually check out a bunch \nof other directories and read-tree, reset, etc all seem to ignore the extra \ndirectory even though they aren't specified in the sparse-checkout file. Is \nthis use mode just not well supported by git yet or am I missing something? \nI'm new to Git so I don't expect to be able to figure it out easily and I \nhaven't been able to find the answer elsewhere.\n\nThanks,\nUri\n"},{"id":"155311","messageId":"AANLkTi=7jeeEw58SQOWmWUx54epWinTuTJE_h=bxcYvO@mail.gmail.com","threadId":"25658","inReplyTo":"loom.20101107T030122-536@post.gmane.org","subject":"Re: Sparse checkouts","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-07T06:39:11Z","receivedAt":"2010-11-07T06:39:11Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sun, Nov 7, 2010 at 9:04 AM, Uri Moszkowicz <uri@4refs.com> wrote:\n> Hi,\n> I'm working with a repository with a very large number of files and Git is\n> appealing because it officially supports sparse checkouts unlike the other\n> DVCS tools. However, all of the usage examples that I've come across have\n> you checkout the full repository and then prune the undesired files as such:\n>\n>  git clone <dir>\n>  git config core.sparsecheckout true\n>  echo \"<dir>/\" > .git/info/sparse-checkout\n>  git read-tree -m -u HEAD\n\nYou can replace the last command with \"git checkout\" (no additional argument)\n\n> I tried adding \"-n\" to the clone command but then none of the missing\n> directories are checked out by read-tree.\n\nHmm.. it works fine here. Can you post the exact sequence of commands you used?\n\n> I can manually check them out\n> and everything seems to work fine but I can also manually check out a bunch\n> of other directories and read-tree, reset, etc all seem to ignore the extra\n> directory even though they aren't specified in the sparse-checkout file\n\nSparse checkout mode does not stop you from checking out non-sparse\nfiles. But all those files are not \"seen\" by git because of sparse\ncheckout mode. They are ignored most of the time, except when git is\ngoing to overwrite them.\n\n> Is this use mode just not well supported by git yet or am I missing something?\n\nSparse checkout support is pretty basic. Any suggestions are welcome.\n-- \nDuy\n"},{"id":"155667","messageId":"AANLkTi=Mz3PjxBUJvRafBjNdpDmPukvdhD40mJkpn8Gk@mail.gmail.com","threadId":"25658","inReplyTo":"AANLkTikahpqj-R7bjEJnPG0FU8Bg26R7Jtf4Lt6JSE+t@mail.gmail.com","subject":"Re: Sparse checkouts","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-11T11:56:51Z","receivedAt":"2010-11-11T11:56:51Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Mon, Nov 8, 2010 at 11:29 PM, Uri Moszkowicz <uri@4refs.com> wrote:\n> Thanks for the reply. \"git checkout\" does seem to work. The exact commands\n> that I used are shown below:\n>>  git clone -n <dir>\n>>  git config core.sparsecheckout true\n>>  echo \"<dir>/\" > .git/info/sparse-checkout\n>>  git read-tree -m -u HEAD\n>\n> It would be nice if sparse checkout mode were more intuitive. A start would\n> be making it on by default. I don't know why the config bit has to be set.\n\nBecause there is overhead in this feature and I guess only a tiny\npercent of users needs it. So it's not enabled by default. When I make\nthe overhead really small, maybe I can convince Junio to enable it by\ndefault.\n\n> Second, when it is enabled, then checkout commands could add the given\n> directories to the sparse checkout list. A checkout command with no sparse\n> checkout file would result in \"*\" being added to the file.\n\nEarlier versions of sparse checkout supported that, sparse rules were\nmuch simpler back then. But because you can now set complex rules in\nsparse checkout file (keep directory a, but not a/b, but keep a/b/c,\nfor example), command line support to edit the file automatically may\ngive unexpected result.\n\nBut I think command line support to just clear sparse checkout file\nand replace it with \"*\" is good.\n\n> Third, when\n> directories are removed it would be nice if they were removed from the\n> sparse checkout file. I don't know if you can trap \"rm\" or if you need to\n> add a new command like \"git remove\".\n\nThat can't be done reliably. If you put pattern \"a/*\" in sparse\ncheckout file, then remove a/b, git is not smart enough to put \"!a/b\"\nin sparse checkout file.\n\n> Third, other commands should try to\n> bring the tree in sync with the sparse checkout list. read-tree and checkout\n> should remove directories which aren't in the list, perhaps throwing an\n> error if there were changes in those directories.\n\nLet me think about this. Not all commands should try to sync, but\nperhaps some of them should.\n\nThank you for your feedback.\n-- \nDuy\n"}]}