{"thread":{"id":"44977","subject":"sparse checkout - weird behavior","startedAt":"2017-01-26T02:59:44Z","lastAt":"2017-01-26T04:57:08Z","messageCount":2,"participants":["Paul Hammant","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"310284","messageId":"CA+298Uh=bfCJq3hmVdGUsinAgKFQd86em_J_8fwB9jQR5PZVgQ@mail.gmail.com","threadId":"44977","inReplyTo":null,"subject":"sparse checkout - weird behavior","fromName":"Paul Hammant","fromEmail":"paul@hammant.org","sentAt":"2017-01-26T02:59:38Z","receivedAt":"2017-01-26T02:59:44Z","isPatch":false,"sender":{"key":"paul@hammant.org","avatar":null},"body":"Here's a simple reproducible bug - something unexpected in sparse-checkout mode:\n\n  $ git clone git@github.com:jekyll/jekyll.git --no-checkout\n  Cloning into 'jekyll'...\n  remote: Counting objects: 41331, done.\n  remote: Compressing objects: 100% (5/5), done.\n  remote: Total 41331 (delta 0), reused 0 (delta 0), pack-reused 41326\n  Receiving objects: 100% (41331/41331), 11.91 MiB | 7.98 MiB/s, done.\n  Resolving deltas: 100% (26530/26530), done.\n  $ cd jekyll\n  $ ls\n  $ git config core.sparsecheckout true\n  $ echo 'docs*' > .git/info/sparse-checkout\n  $ git read-tree -mu HEAD\n  $ ls\n  docs rake\n\nI didn't expect to see 'rake' amongst the results.\n\nIf I take out the asterisk on the echo line, only 'docs' is checked\nout after the read-tree operation. Even if asterisk isn't allowed, I'd\nnot expect it to fail in that way. Sparse checkout documentation is a\nlittle . .. . sparse it has to be said (sorry).\n\nAs it happens, I have some more complicated cases where\nsparse-checkout is doing the wrong thing in the working copy - and\nI'll work towards reproduction of that/those after this. Best to start\nwith a simple reproducible case in case there's a simple fix for more\nthat one similar bug.\n\nRegards,\n\n- Paul\n"},{"id":"310291","messageId":"20170126045701.eouw5kzyq5bevc5c@sigill.intra.peff.net","threadId":"44977","inReplyTo":"CA+298Uh=bfCJq3hmVdGUsinAgKFQd86em_J_8fwB9jQR5PZVgQ@mail.gmail.com","subject":"Re: sparse checkout - weird behavior","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-01-26T04:57:01Z","receivedAt":"2017-01-26T04:57:08Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jan 25, 2017 at 09:59:38PM -0500, Paul Hammant wrote:\n\n> Here's a simple reproducible bug - something unexpected in sparse-checkout mode:\n> \n>   $ git clone git@github.com:jekyll/jekyll.git --no-checkout\n>   Cloning into 'jekyll'...\n>   remote: Counting objects: 41331, done.\n>   remote: Compressing objects: 100% (5/5), done.\n>   remote: Total 41331 (delta 0), reused 0 (delta 0), pack-reused 41326\n>   Receiving objects: 100% (41331/41331), 11.91 MiB | 7.98 MiB/s, done.\n>   Resolving deltas: 100% (26530/26530), done.\n>   $ cd jekyll\n>   $ ls\n>   $ git config core.sparsecheckout true\n>   $ echo 'docs*' > .git/info/sparse-checkout\n>   $ git read-tree -mu HEAD\n>   $ ls\n>   docs rake\n> \n> I didn't expect to see 'rake' amongst the results.\n\nIf you look inside the rake/ directory, you should see that only\n\"docs.rake\" was checked out.\n\nThe sparse-checkout file uses the same parser as .git/info/exclude. One\nimportant aspect of that file is that entries are _not_ left-anchored\nunless they start with \"/\". So you asked Git to include files named\n\"docs*\" anywhere in the tree.\n\nYou probably wanted just:\n\n  echo /docs >.git/info/sparse-checkout\n\n-Peff\n"}]}