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

[PATCH v2 12/12] sparse-checkout: improve docs around 'set' in cone mode

From
Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
Date
Jan 24, 2020, 21:19 UTC
Message-ID
<1b5858adee36e326b7a98f3ca2a3c36c9ba5b85c.1579900782.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.513.v2.git.1579900782.gitgitgadget@gmail.com>
From: Derrick Stolee <dstolee@microsoft.com>

The existing documentation does not clarify how the 'set' subcommand changes when core.sparseCheckoutCone is enabled. Correct this by changing some language around the "A/B/C" example. Also include a description of the input format matching the output of 'git ls-tree --name-only'.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
---
 Documentation/git-sparse-checkout.txt | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/Documentation/git-sparse-checkout.txt b/Documentation/git-sparse-checkout.txt
index 4834fb434d..0914619881 100644
--- a/Documentation/git-sparse-checkout.txt
+++ b/Documentation/git-sparse-checkout.txt
@@ -50,6 +50,14 @@ To avoid interfering with other worktrees, it first enables the
 +
 When the `--stdin` option is provided, the patterns are read from
 standard in as a newline-delimited list instead of from the arguments.
++
+When `core.sparseCheckoutCone` is enabled, the input list is considered a
+list of directories instead of sparse-checkout patterns. The command writes
+patterns to the sparse-checkout file to include all files contained in those
+directories (recursively) as well as files that are siblings of ancestor
+directories. The input format matches the output of `git ls-tree --name-only`.
+This includes interpreting pathnames that begin with a double quote (") as
+C-style quoted strings.
 
 'disable'::
 	Disable the `core.sparseCheckout` config setting, and restore the
@@ -128,9 +136,12 @@ the following patterns:
 ----------------
 
 This says "include everything in root, but nothing two levels below root."
-If we then add the folder `A/B/C` as a recursive pattern, the folders `A` and
-`A/B` are added as parent patterns. The resulting sparse-checkout file is
-now
+
+When in cone mode, the `git sparse-checkout set` subcommand takes a list of
+directories instead of a list of sparse-checkout patterns. In this mode,
+the command `git sparse-checkout set A/B/C` sets the directory `A/B/C` as
+a recursive pattern, the directories `A` and `A/B` are added as parent
+patterns. The resulting sparse-checkout file is now
 
 ----------------
 /*
-- 
gitgitgadget
Previous: Derrick Stolee via GitGitGadgetNext: Derrick Stolee via GitGitGadget
Message 37 of 82 in “Harden the sparse-checkout builtin”
  1. 0/8 Harden the sparse-checkout builtinDerrick Stolee via GitGitGadget, Jan 14, 2020
  2. 2/8 sparse-checkout: create leading directoriesDerrick Stolee via GitGitGadget, Jan 14, 2020
  3. Junio C HamanoJan 16, 2020
  4. 1/8 t1091: use check_files to reduce boilerplateDerrick Stolee via GitGitGadget, Jan 14, 2020
  5. Junio C HamanoJan 16, 2020
  6. 4/8 sparse-checkout: cone mode does not recognize "**"Derrick Stolee via GitGitGadget, Jan 14, 2020
  7. Jeff KingJan 14, 2020
  8. 5/8 sparse-checkout: detect short patternsDerrick Stolee via GitGitGadget, Jan 14, 2020
  9. 3/8 clone: fix --sparse option with URLsDerrick Stolee via GitGitGadget, Jan 14, 2020
  10. Taylor BlauJan 14, 2020
  11. 7/8 sparse-checkout: properly match escaped charactersDerrick Stolee via GitGitGadget, Jan 14, 2020
  12. Jeff KingJan 14, 2020
  13. Derrick StoleeJan 14, 2020
  14. 6/8 sparse-checkout: warn on incorrect '*' in patternsDerrick Stolee via GitGitGadget, Jan 14, 2020
  15. 8/8 sparse-checkout: write escaped patterns in cone modeDerrick Stolee via GitGitGadget, Jan 14, 2020
  16. Jeff KingJan 14, 2020
  17. Derrick StoleeJan 14, 2020
  18. Jeff KingJan 14, 2020
  19. Derrick StoleeJan 24, 2020
  20. Jeff KingJan 24, 2020
  21. Derrick StoleeJan 28, 2020
  22. Taylor BlauJan 14, 2020
  23. Derrick StoleeJan 14, 2020
  24. Jeff KingJan 14, 2020
  25. Junio C HamanoJan 15, 2020
  26. Derrick StoleeJan 15, 2020
  27. 00/12 Harden the sparse-checkout builtinDerrick Stolee via GitGitGadget, Jan 24, 2020
  28. 01/12 t1091: use check_files to reduce boilerplateDerrick Stolee via GitGitGadget, Jan 24, 2020
  29. 02/12 t1091: improve here-docsDerrick Stolee via GitGitGadget, Jan 24, 2020
  30. 04/12 clone: fix --sparse option with URLsDerrick Stolee via GitGitGadget, Jan 24, 2020
  31. 05/12 sparse-checkout: fix documentation typo for core.sparseCheckoutConeJeff King via GitGitGadget, Jan 24, 2020
  32. 06/12 sparse-checkout: cone mode does not recognize "**"Derrick Stolee via GitGitGadget, Jan 24, 2020
  33. 03/12 sparse-checkout: create leading directoriesDerrick Stolee via GitGitGadget, Jan 24, 2020
  34. 09/12 sparse-checkout: properly match escaped charactersDerrick Stolee via GitGitGadget, Jan 24, 2020
  35. 08/12 sparse-checkout: warn on incorrect '*' in patternsDerrick Stolee via GitGitGadget, Jan 24, 2020
  36. 07/12 sparse-checkout: detect short patternsDerrick Stolee via GitGitGadget, Jan 24, 2020
  37. 12/12 sparse-checkout: improve docs around 'set' in cone modeDerrick Stolee via GitGitGadget, Jan 24, 2020
  38. 10/12 sparse-checkout: write escaped patterns in cone modeDerrick Stolee via GitGitGadget, Jan 24, 2020
  39. 11/12 sparse-checkout: use C-style quotes in 'list' subcommandDerrick Stolee via GitGitGadget, Jan 24, 2020
  40. 00/12 Harden the sparse-checkout builtinDerrick Stolee via GitGitGadget, Jan 28, 2020
  41. 01/12 t1091: use check_files to reduce boilerplateDerrick Stolee via GitGitGadget, Jan 28, 2020
  42. 02/12 t1091: improve here-docsDerrick Stolee via GitGitGadget, Jan 28, 2020
  43. 04/12 clone: fix --sparse option with URLsDerrick Stolee via GitGitGadget, Jan 28, 2020
  44. 05/12 sparse-checkout: fix documentation typo for core.sparseCheckoutConeJeff King via GitGitGadget, Jan 28, 2020
  45. 03/12 sparse-checkout: create leading directoriesDerrick Stolee via GitGitGadget, Jan 28, 2020
  46. 06/12 sparse-checkout: cone mode does not recognize "**"Derrick Stolee via GitGitGadget, Jan 28, 2020
  47. 11/12 sparse-checkout: use C-style quotes in 'list' subcommandDerrick Stolee via GitGitGadget, Jan 28, 2020
  48. Jeff KingJan 29, 2020
  49. 12/12 sparse-checkout: improve docs around 'set' in cone modeDerrick Stolee via GitGitGadget, Jan 28, 2020
  50. 10/12 sparse-checkout: write escaped patterns in cone modeDerrick Stolee via GitGitGadget, Jan 28, 2020
  51. Jeff KingJan 29, 2020
  52. Jeff KingJan 29, 2020
  53. Derrick StoleeJan 29, 2020
  54. Derrick StoleeJan 29, 2020
  55. Jeff KingJan 30, 2020
  56. Derrick StoleeJan 30, 2020
  57. 08/12 sparse-checkout: warn on incorrect '*' in patternsDerrick Stolee via GitGitGadget, Jan 28, 2020
  58. 07/12 sparse-checkout: detect short patternsDerrick Stolee via GitGitGadget, Jan 28, 2020
  59. 09/12 sparse-checkout: properly match escaped charactersDerrick Stolee via GitGitGadget, Jan 28, 2020
  60. Jeff KingJan 29, 2020
  61. Derrick StoleeJan 29, 2020
  62. Derrick StoleeJan 29, 2020
  63. 00/15 Harden the sparse-checkout builtinDerrick Stolee via GitGitGadget, Jan 31, 2020
  64. 01/15 t1091: use check_files to reduce boilerplateDerrick Stolee via GitGitGadget, Jan 31, 2020
  65. 02/15 t1091: improve here-docsDerrick Stolee via GitGitGadget, Jan 31, 2020
  66. 04/15 clone: fix --sparse option with URLsDerrick Stolee via GitGitGadget, Jan 31, 2020
  67. 06/15 sparse-checkout: cone mode does not recognize "**"Derrick Stolee via GitGitGadget, Jan 31, 2020
  68. 07/15 sparse-checkout: detect short patternsDerrick Stolee via GitGitGadget, Jan 31, 2020
  69. 05/15 sparse-checkout: fix documentation typo for core.sparseCheckoutConeJeff King via GitGitGadget, Jan 31, 2020
  70. 08/15 sparse-checkout: warn on globs in cone patternsDerrick Stolee via GitGitGadget, Jan 31, 2020
  71. 03/15 sparse-checkout: create leading directoriesDerrick Stolee via GitGitGadget, Jan 31, 2020
  72. 09/15 sparse-checkout: properly match escaped charactersDerrick Stolee via GitGitGadget, Jan 31, 2020
  73. 11/15 sparse-checkout: unquote C-style strings over --stdinDerrick Stolee via GitGitGadget, Jan 31, 2020
  74. 10/15 sparse-checkout: write escaped patterns in cone modeDerrick Stolee via GitGitGadget, Jan 31, 2020
  75. 15/15 sparse-checkout: fix cone mode behavior mismatchDerrick Stolee via GitGitGadget, Jan 31, 2020
  76. 14/15 sparse-checkout: improve docs around 'set' in cone modeDerrick Stolee via GitGitGadget, Jan 31, 2020
  77. 12/15 sparse-checkout: use C-style quotes in 'list' subcommandDerrick Stolee via GitGitGadget, Jan 31, 2020
  78. 13/15 sparse-checkout: escape all glob characters on writeDerrick Stolee via GitGitGadget, Jan 31, 2020
  79. Elijah NewrenJan 31, 2020
  80. Derrick StoleeFeb 3, 2020
  81. Taylor BlauFeb 8, 2020
  82. Junio C HamanoFeb 9, 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.