git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* sparse checkout - weird behavior
@ 2017-01-26  2:59 Paul Hammant
  2017-01-26  4:57 ` Jeff King
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Hammant @ 2017-01-26  2:59 UTC (permalink / raw)
  To: git

Here's a simple reproducible bug - something unexpected in sparse-checkout mode:

  $ git clone git@github.com:jekyll/jekyll.git --no-checkout
  Cloning into 'jekyll'...
  remote: Counting objects: 41331, done.
  remote: Compressing objects: 100% (5/5), done.
  remote: Total 41331 (delta 0), reused 0 (delta 0), pack-reused 41326
  Receiving objects: 100% (41331/41331), 11.91 MiB | 7.98 MiB/s, done.
  Resolving deltas: 100% (26530/26530), done.
  $ cd jekyll
  $ ls
  $ git config core.sparsecheckout true
  $ echo 'docs*' > .git/info/sparse-checkout
  $ git read-tree -mu HEAD
  $ ls
  docs rake

I didn't expect to see 'rake' amongst the results.

If I take out the asterisk on the echo line, only 'docs' is checked
out after the read-tree operation. Even if asterisk isn't allowed, I'd
not expect it to fail in that way. Sparse checkout documentation is a
little . .. . sparse it has to be said (sorry).

As it happens, I have some more complicated cases where
sparse-checkout is doing the wrong thing in the working copy - and
I'll work towards reproduction of that/those after this. Best to start
with a simple reproducible case in case there's a simple fix for more
that one similar bug.

Regards,

- Paul

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: sparse checkout - weird behavior
@ 2017-01-26  3:21 Paul Hammant
  2017-01-26  4:59 ` Jeff King
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Hammant @ 2017-01-26  3:21 UTC (permalink / raw)
  To: git

Related bug (maybe the same). Reproduction:

  $ git clone git@github.com:jekyll/jekyll.git --no-checkout
  Cloning into 'jekyll'...
  remote: Counting objects: 41331, done.
  remote: Compressing objects: 100% (5/5), done.
  remote: Total 41331 (delta 0), reused 0 (delta 0), pack-reused 41326
  Receiving objects: 100% (41331/41331), 11.91 MiB | 9.15 MiB/s, done.
  Resolving deltas: 100% (26530/26530), done.
  $ cd jekyll
  $ git config core.sparsecheckout true
  $ echo 'CONDUCT.markdown' > .git/info/sparse-checkout
  $ echo 'Gemfile' >> .git/info/sparse-checkout
  $ echo 'Rakefile' >> .git/info/sparse-checkout
  $ echo 'appveyor.yml' >> .git/info/sparse-checkout
  $ git checkout --
  Your branch is up-to-date with 'origin/master'.
  $ ls
  CONDUCT.markdown Gemfile Rakefile appveyor.yml lib

I was not expecting to see 'lib' in the resulting file list

I didn't say so before - I'm on a Mac, with a homebrew installed Git 2.11.0

- Paul

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: sparse checkout - weird behavior
  2017-01-26  2:59 sparse checkout - weird behavior Paul Hammant
@ 2017-01-26  4:57 ` Jeff King
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff King @ 2017-01-26  4:57 UTC (permalink / raw)
  To: Paul Hammant; +Cc: git

On Wed, Jan 25, 2017 at 09:59:38PM -0500, Paul Hammant wrote:

> Here's a simple reproducible bug - something unexpected in sparse-checkout mode:
> 
>   $ git clone git@github.com:jekyll/jekyll.git --no-checkout
>   Cloning into 'jekyll'...
>   remote: Counting objects: 41331, done.
>   remote: Compressing objects: 100% (5/5), done.
>   remote: Total 41331 (delta 0), reused 0 (delta 0), pack-reused 41326
>   Receiving objects: 100% (41331/41331), 11.91 MiB | 7.98 MiB/s, done.
>   Resolving deltas: 100% (26530/26530), done.
>   $ cd jekyll
>   $ ls
>   $ git config core.sparsecheckout true
>   $ echo 'docs*' > .git/info/sparse-checkout
>   $ git read-tree -mu HEAD
>   $ ls
>   docs rake
> 
> I didn't expect to see 'rake' amongst the results.

If you look inside the rake/ directory, you should see that only
"docs.rake" was checked out.

The sparse-checkout file uses the same parser as .git/info/exclude. One
important aspect of that file is that entries are _not_ left-anchored
unless they start with "/". So you asked Git to include files named
"docs*" anywhere in the tree.

You probably wanted just:

  echo /docs >.git/info/sparse-checkout

-Peff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: sparse checkout - weird behavior
  2017-01-26  3:21 Paul Hammant
@ 2017-01-26  4:59 ` Jeff King
  2017-01-26 11:20   ` Paul Hammant
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff King @ 2017-01-26  4:59 UTC (permalink / raw)
  To: Paul Hammant; +Cc: git

On Wed, Jan 25, 2017 at 10:21:19PM -0500, Paul Hammant wrote:

> Related bug (maybe the same). Reproduction:
> 
>   $ git clone git@github.com:jekyll/jekyll.git --no-checkout
>   Cloning into 'jekyll'...
>   remote: Counting objects: 41331, done.
>   remote: Compressing objects: 100% (5/5), done.
>   remote: Total 41331 (delta 0), reused 0 (delta 0), pack-reused 41326
>   Receiving objects: 100% (41331/41331), 11.91 MiB | 9.15 MiB/s, done.
>   Resolving deltas: 100% (26530/26530), done.
>   $ cd jekyll
>   $ git config core.sparsecheckout true
>   $ echo 'CONDUCT.markdown' > .git/info/sparse-checkout
>   $ echo 'Gemfile' >> .git/info/sparse-checkout
>   $ echo 'Rakefile' >> .git/info/sparse-checkout
>   $ echo 'appveyor.yml' >> .git/info/sparse-checkout
>   $ git checkout --
>   Your branch is up-to-date with 'origin/master'.
>   $ ls
>   CONDUCT.markdown Gemfile Rakefile appveyor.yml lib
> 
> I was not expecting to see 'lib' in the resulting file list

Yep, I think this is the same problem. Inside lib, you get only
"lib/theme_template/Gemfile", because it matches your unanchored
pattern. Using "/Gemfile" in the sparse-checkout file fixes it.

-Peff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: sparse checkout - weird behavior
  2017-01-26  4:59 ` Jeff King
@ 2017-01-26 11:20   ` Paul Hammant
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Hammant @ 2017-01-26 11:20 UTC (permalink / raw)
  To: Jeff King; +Cc: git

Well I feel a bit silly. Thanks for responding.

On Wed, Jan 25, 2017 at 11:59 PM, Jeff King <peff@peff.net> wrote:
> On Wed, Jan 25, 2017 at 10:21:19PM -0500, Paul Hammant wrote:
>
>> Related bug (maybe the same). Reproduction:
>>
>>   $ git clone git@github.com:jekyll/jekyll.git --no-checkout
>>   Cloning into 'jekyll'...
>>   remote: Counting objects: 41331, done.
>>   remote: Compressing objects: 100% (5/5), done.
>>   remote: Total 41331 (delta 0), reused 0 (delta 0), pack-reused 41326
>>   Receiving objects: 100% (41331/41331), 11.91 MiB | 9.15 MiB/s, done.
>>   Resolving deltas: 100% (26530/26530), done.
>>   $ cd jekyll
>>   $ git config core.sparsecheckout true
>>   $ echo 'CONDUCT.markdown' > .git/info/sparse-checkout
>>   $ echo 'Gemfile' >> .git/info/sparse-checkout
>>   $ echo 'Rakefile' >> .git/info/sparse-checkout
>>   $ echo 'appveyor.yml' >> .git/info/sparse-checkout
>>   $ git checkout --
>>   Your branch is up-to-date with 'origin/master'.
>>   $ ls
>>   CONDUCT.markdown Gemfile Rakefile appveyor.yml lib
>>
>> I was not expecting to see 'lib' in the resulting file list
>
> Yep, I think this is the same problem. Inside lib, you get only
> "lib/theme_template/Gemfile", because it matches your unanchored
> pattern. Using "/Gemfile" in the sparse-checkout file fixes it.
>
> -Peff

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-01-26 11:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-26  2:59 sparse checkout - weird behavior Paul Hammant
2017-01-26  4:57 ` Jeff King
  -- strict thread matches above, loose matches on Subject: below --
2017-01-26  3:21 Paul Hammant
2017-01-26  4:59 ` Jeff King
2017-01-26 11:20   ` Paul Hammant

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).