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

Re: [PATCH v3] repo_read_index: add config to expect files outside sparse patterns

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Feb 25, 2022, 16:33 UTC
Message-ID
<YhkE2vxI4nM3ut0K@google.com>
In-Reply-To
<20220224052259.30498-1-newren@gmail.com>
Hi,
Elijah Newren wrote:
> Signed-off-by: Elijah Newren <newren@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>

Thanks, and sorry for the slow review. My one remaining area for nits is the documentation, but that can be improved iteratively via patches on top.

[...]
Show 9 quoted lines
> --- /dev/null
> +++ b/Documentation/config/sparse.txt
> @@ -0,0 +1,28 @@
> +sparse.expectFilesOutsideOfPatterns::
> +	Typically with sparse checkouts, files not matching any
> +	sparsity patterns are marked as such in the index file and
> +	missing from the working tree.  Accordingly, Git will
> +	ordinarily check whether files that the index indicates are
> +	outside of the sparse area are present in the working tree and

Junio mentioned the "sparse area" could suggest that the area is itself sparse and devoid of files, so it might not have been the best choice of words on my part. Perhaps "whether files that the index indicates are not checked out are present in the working tree" would work here?

Show 8 quoted lines
> +	mark them as present in the index if so.  This option can be
> +	used to tell Git that such present-but-unmatching files are
> +	expected and to stop checking for them.
> ++
> +The default is `false`.  Paths which are marked as SKIP_WORKTREE
> +despite being present (which can occur for a few different reasons)
> +typically present a range of problems which are difficult for users to
> +discover and recover from.  The default setting avoids such issues.

The git-sparse-checkout(1) page never describes what SKIP_WORKTREE means, so it might not be obvious to them what this means. Also, the "can occur for a few different reasons" may leave the user wondering whether they are subject to those reasons. What the reader wants to know is "I should keep using the default because it makes Git work better", so how about something like

 The default is `false`, which allows Git to automatically recover
 from the list of files in the index and working tree falling out of
 sync.
 +
?
Show 10 quoted lines
> ++
> +A Git-based virtual file system (VFS) can turn the usual expectation
> +on its head: files are present in the working copy but do not take
> +up much disk space because their contents are not downloaded until
> +they are accessed.  With such a virtual file system layer, most files
> +do not match the sparsity patterns at first, and the VFS layer
> +updates the sparsity patterns to add more files whenever files are
> +written.  Setting this to `true` supports such a setup where files are
> +expected to be present outside the sparse area and a separate, robust
> +mechanism is responsible for keeping the sparsity patterns up to date.

Here I spent most of the words explaining what a Git-based VFS layer is, which is also not too relevant to most users (who are just interested in "is `true` the right value for me?"). How about reducing it to the following?

 Set this to `true` if you are in a setup where extra files are expected
 to be present and a separate, robust mechanism is responsible for
 keeping the sparsity patterns up to date, such as a Git-aware virtual
 file system.
?
> ++
> +Note that the checking and clearing of the SKIP_WORKTREE bit only
> +happens when core.sparseCheckout is true, so this config option has no
> +effect unless core.sparseCheckout is true.

Good note. Same nit about the user not necessarily knowing what SKIP_WORKTREE means applies. Also, we can remove the extra words "Note that" since the dutiful reader should be noting everything we say. :) I think that would make

 +
 Regardless of this setting, Git does not check for
 present-but-unmatching files unless sparse checkout is enabled, so
 this config option has no effect unless `core.sparseCheckout` is
 `true`.

Thanks, Jonathan

Previous: Elijah NewrenNext: Elijah Newren
Message 23 of 29 in “Provide config option to expect files outside sparse patterns”
  1. Provide config option to expect files outside sparse patternsElijah Newren via GitGitGadget, Feb 20, 2022
  2. Derrick StoleeFeb 20, 2022
  3. Junio C HamanoFeb 20, 2022
  4. Elijah NewrenFeb 22, 2022
  5. Johannes SchindelinFeb 22, 2022
  6. Derrick StoleeFeb 22, 2022
  7. Johannes SchindelinFeb 21, 2022
  8. Ævar Arnfjörð BjarmasonFeb 21, 2022
  9. Elijah NewrenFeb 22, 2022
  10. Johannes SchindelinFeb 22, 2022
  11. Ævar Arnfjörð BjarmasonFeb 22, 2022
  12. Jonathan NiederFeb 22, 2022
  13. Ævar Arnfjörð BjarmasonFeb 25, 2022
  14. Elijah NewrenFeb 22, 2022
  15. Ævar Arnfjörð BjarmasonFeb 22, 2022
  16. Johannes SchindelinFeb 22, 2022
  17. Derrick StoleeFeb 22, 2022
  18. repo_read_index: add config to expect files outside sparse patternsJonathan Nieder, Feb 23, 2022
  19. Elijah NewrenFeb 23, 2022
  20. repo_read_index: add config to expect files outside sparse patternsElijah Newren, Feb 24, 2022
  21. Junio C HamanoFeb 24, 2022
  22. Elijah NewrenFeb 26, 2022
  23. Jonathan NiederFeb 25, 2022
  24. Elijah NewrenFeb 26, 2022
  25. repo_read_index: add config to expect files outside sparse patternsElijah Newren, Feb 26, 2022
  26. repo_read_index: add config to expect files outside sparse patternsElijah Newren, Mar 2, 2022
  27. Junio C HamanoMar 2, 2022
  28. Elijah NewrenMar 2, 2022
  29. Derrick StoleeMar 2, 2022

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.