Subject: Re: [PATCH] Provide config option to expect files outside sparse patterns

From: Derrick Stolee <[email-masked]>
Date: Sun, 20 Feb 2022 14:41:55 -0500

On 2/20/2022 12:05 AM, Elijah Newren via GitGitGadget wrote:
> From: Elijah Newren <[email-masked]>
> 
> Typically with sparse checkouts, we expect files outside the sparsity
> patterns to be marked as SKIP_WORKTREE and be missing from the working
> tree.  VFS for Git can be used to turn this expectation on its head:
> all files are considered present in the working copy, though they are
> not vivified until first access access.  With VFS for Git, most of the
> files do not match the sparsity patterns at first, and the VFS layer
> automatically updates the sparsity patterns to add more files whenever
> files are written.
> 
> With this background, this special usecase does not play well with the
> safety check we added in commit 11d46a399d ("repo_read_index: clear
> SKIP_WORKTREE bit from files present in worktree", 2022-01-06).
> Checking SKIP_WORKTREE files to see if they are present in the working
> tree causes them all to be immediately vivified.  Further, the special
> VFS layer, by virtue of automatically updating the sparsity patterns and
> catching all accesses, isn't in need of that safety check either.
> Provide a configuration option, core.expectFilesOutsideSparsePatterns
> so that those with this special usecase can turn off the safety check.

This patch looks like a good solution to the concerns brought up by
Jonathan N. around vfsd. VFS for Git uses the microsoft/git fork with
its own custom config to protect things like this. I imagine that we
will start setting your core_expect_files_outside_sparse_patterns
variable when reading the virtual filesystem info. We might even modify
some of our custom checks to use this variable instead. That would make
them appropriate to send upstream.

Should we update Documentation/config/core.txt describing this config
key? Or is this intended to be an internal detail only for something
like vfsd?

The only concern here really is if we want to be picky about the "VFS
for Git" references instead of "vfsd" references in the commit message.

Thanks,
-Stolee