git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Sparse Checkout Trouble (2.5.0)

From
Elijah Newren <newren@gmail.com>
Date
Jan 25, 2020, 20:59 UTC
Message-ID
<CABPp-BFB3pN1arWb9Acj7La1aX7j=axANnSWV8f7SmW_KuqD0g@mail.gmail.com>
In-Reply-To
<405d83bd-cd50-49c5-a068-6d3ce102f669@gmail.com>
On Fri, Jan 24, 2020 at 7:41 AM Derrick Stolee <stolee@gmail.com> wrote:
Show 52 quoted lines
>
> On 1/21/2020 8:19 PM, Derrick Stolee wrote:
> > On 1/21/2020 7:42 PM, JunkYardMail1 wrote:
> >> Reverting back to the previous version (2.24.1) allowed to un-stage the
> >> files and reset the changes.
> >
> > This is definitely pointing to a regression, and the feature did get a
> > bit of an overhaul. The goal was to not change how existing users
> > interacted with it, though, so this is a bit alarming.
> >
> > I did find a behavior change related to these paths in Git for Windows
> > 2.25.0 versus 2.24.1:
> >
> >   $ git clone https://github.com/derrickstolee/git-sparse-checkout-test
> >   Cloning into 'git-sparse-checkout-test'...
> >   remote: Enumerating objects: 6, done.
> >   remote: Counting objects: 100% (6/6), done.
> >   remote: Compressing objects: 100% (4/4), done.
> >   remote: Total 6 (delta 0), reused 6 (delta 0), pack-reused 0
> >   Receiving objects: 100% (6/6), done.
> >   error: invalid path 'directory-1/prn/a'
> >   fatal: unable to checkout working tree
> >   warning: Clone succeeded, but checkout failed.
> >   You can inspect what was checked out with 'git status'
> >   and retry with 'git restore --source=HEAD :/'
> >
> > The checkout here is _expected_ to fail, due to the protected
> > filenames. What is troublesome is the following sparse-checkout
> > commands fail, and the read-tree command fails in a way that
> > 2.24.1 does not:
> >
> >   $ git sparse-checkout init
> >   error: invalid path 'directory-1/prn/a'
> >   error: invalid path 'directory-1/prn/a'
> >
> >   $ git sparse-checkout set "/*" "\!/*/"
> >   error: invalid path 'directory-1/prn/a'
> >   error: invalid path 'directory-1/prn/a'
> >
> >   $ git read-tree -mu HEAD
> >   error: invalid path 'directory-1/prn/a'
> >
> > The double error messages are due to the "try with an in-memory
> > pattern set, then roll back if there is a failure." The patterns
> > we are trying to create do not include the directory that is failing.
> >
> > I'll keep looking into this.
>
> I am still struggling to find out exactly what goes wrong here.
>
> I'm CC'ing Elijah because he also made changes to dir.c, and
> perhaps he has some idea of what's going on.

If you think it might be related to the dir.c changes, I can take a look. I don't have any immediate ideas off the top of my head. However, since I'm really suffering with "git read-tree -mu HEAD" being the mechanism for updating sparsity (for reasons independent of the issue being discussed here), I've been tempted to dig into that anyway to write a replacement without the nasty side-effects. I'll take a look early next week and see if I can spot anything.

Show 6 quoted lines
> Using GIT_TRACE2_PERF=1, I can see that the error appears during
> the traverse_trees() which is after the sparse-checkout patterns
> have applied the skip-worktree bit.
>
> Thanks,
> -Stolee
Previous: Derrick StoleeNext: Derrick Stolee
Message 5 of 11 in “Sparse Checkout Trouble (2.5.0)”
  1. JunkYardMail1Jan 22, 2020
  2. Derrick StoleeJan 22, 2020
  3. JunkYardMail1Jan 22, 2020
  4. Derrick StoleeJan 24, 2020
  5. Elijah NewrenJan 25, 2020
  6. Derrick StoleeJan 26, 2020
  7. Elijah NewrenJan 28, 2020
  8. Derrick StoleeJan 28, 2020
  9. Johannes SchindelinJan 29, 2020
  10. Derrick StoleeJan 29, 2020
  11. Derrick StoleeJan 29, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.