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

[PATCH v2 0/9] sparse-checkout: make cone mode the default

From
Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>
Date
Mar 12, 2022, 03:11 UTC
Message-ID
<pull.1148.v2.git.1647054681.gitgitgadget@gmail.com>
In-Reply-To
<pull.1148.git.1646725188.gitgitgadget@gmail.com>
== Updates Log ==
Changes since v1:
 * rebased on master, to remove dependence on en/present-despite-skipped
   (which has since merged to master). Earlier version of series wasn't
   picked up anyway, so rebasing should be safe.
 * Wording and code style tweaks suggested by Stolee in his review
== Overview ==

This patch changes the default mode for sparse-checkout from non-cone mode to cone-mode, and marks non-cone mode as deprecated. There is no plan to remove non-cone mode, we are merely recommending against its use.

The code change is pretty small, and most of this series is about documentation updates -- to focus on directories rather than patterns, to explain the new default, to explain why we are deprecating non-cone mode (the final patch), and to make other related cleanups to simplify the manual.

Patch 1: Update tests to not assume cone-mode is the default Patch 2: Make cone-mode the default Patches 3-9: Various updates to git-sparse-checkout.txt, divided up for ease of review

== Alternative ==

There is one primary alternative to this series: make sparse-checkout error when neither --cone nor --no-cone are specified (so that there is no default), and wait until a future date to make --cone the default. That'd be reasonable, but I had three reason to avoid going this route (note that item 2 means there's little practical difference between cone-mode-as-default and no-mode-is-default):

 1. git-sparse-checkout.txt has the following huge warning early in the
    manual:

""" THIS COMMAND IS EXPERIMENTAL. ITS BEHAVIOR, AND THE BEHAVIOR OF OTHER COMMANDS IN THE PRESENCE OF SPARSE-CHECKOUTS, WILL LIKELY CHANGE IN THE FUTURE. """

 2. If users are unaware of the default change and attempt to provide
    patterns instead of directories, then they will get error messages added
    from en/sparse-checkout-fixes. They can learn at that time to get around
    the error messages by providing --no-cone.
 3. If users are unaware of the default change and provide directories, then
    that's where non-cone mode and cone mode overlap and things happen to
    work. (There is a slight difference in that cone mode will include files
    from parent directories of any specified directory, but that means the
    user gets a few more files in their sparse-checkout with cone mode than
    they would with non-cone mode.)
== CCs ==
Elijah Newren (9):
  tests: stop assuming --no-cone is the default mode for sparse-checkout
  sparse-checkout: make --cone the default
  git-sparse-checkout.txt: wording updates for the cone mode default
  git-sparse-checkout.txt: update docs for deprecation of 'init'
  git-sparse-checkout.txt: shuffle some sections and mark as internal
  git-sparse-checkout.txt: add a new EXAMPLES section
  git-sparse-checkout.txt: flesh out non-cone mode pattern discussion a
    bit
  git-sparse-checkout.txt: mark non-cone mode as deprecated
  Documentation: some sparsity wording clarifications
 Documentation/git-read-tree.txt       |   9 +-
 Documentation/git-sparse-checkout.txt | 249 +++++++++++++++++++-------
 builtin/sparse-checkout.c             |   2 +-
 t/t1091-sparse-checkout-builtin.sh    |  15 +-
 t/t3602-rm-sparse-checkout.sh         |   6 +-
 t/t3705-add-sparse-checkout.sh        |   4 +-
 t/t6428-merge-conflicts-sparse.sh     |   4 +-
 t/t7002-mv-sparse-checkout.sh         |   2 +-
 t/t7012-skip-worktree-writing.sh      |   2 +-
 9 files changed, 207 insertions(+), 86 deletions(-)
base-commit: 1a4874565fa3b6668042216189551b98b4dc0b1b
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1148%2Fnewren%2Fsparse-checkout-default-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1148/newren/sparse-checkout-default-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/1148
Range-diff vs v1:
  1:  8c3e730e86b =  1:  05dba7069c5 tests: stop assuming --no-cone is the default mode for sparse-checkout
  2:  b174b42ed82 !  2:  a53179764bc sparse-checkout: make --cone the default
     @@ builtin/sparse-checkout.c: static int update_modes(int *cone_mode, int *sparse_i
       	/* Set cone/non-cone mode appropriately */
       	core_apply_sparse_checkout = 1;
      -	if (*cone_mode == 1) {
     -+	if (*cone_mode == 1 || *cone_mode == -1) {
     ++	if (*cone_mode) { /* also handles "not specified" (value of -1) */
       		mode = MODE_CONE_PATTERNS;
       		core_sparse_checkout_cone = 1;
       	} else {
  3:  f98b3fac78a =  3:  8eab21996c7 git-sparse-checkout.txt: wording updates for the cone mode default
  4:  cd871966c06 =  4:  eb3b318b39e git-sparse-checkout.txt: update docs for deprecation of 'init'
  5:  fe37a966699 =  5:  7333198b778 git-sparse-checkout.txt: shuffle some sections and mark as internal
  6:  3265f41bcab !  6:  a814ea9e8d2 git-sparse-checkout.txt: add a new EXAMPLES section
     @@ Documentation/git-sparse-checkout.txt: paths to pass to a subsequent 'set' or 'a
      +
      +`git sparse-checkout reapply`::
      +
     -+	It is possible for commands to update the working tree in a way
     -+	that does not respect the selected sparsity directories, either
     -+	because of special cases (such as hitting conflicts when
     -+	merging/rebasing), or because some commands didn't fully support
     -+	sparse checkouts (e.g. the old `recursive` merge backend had
     -+	only limited support).  This command reapplies the existing
     -+	sparse directory specifications to make the working directory
     -+	match.
     ++	It is possible for commands to update the working tree in a
     ++	way that does not respect the selected sparsity directories.
     ++	This can come from tools external to Git writing files, or
     ++	even affect Git commands because of either special cases (such
     ++	as hitting conflicts when merging/rebasing), or because some
     ++	commands didn't fully support sparse checkouts (e.g. the old
     ++	`recursive` merge backend had only limited support).  This
     ++	command reapplies the existing sparse directory specifications
     ++	to make the working directory match.
      +
       INTERNALS -- SPARSE CHECKOUT
       ----------------------------
  7:  bdbf61ee6a0 =  7:  78028ecaa58 git-sparse-checkout.txt: flesh out non-cone mode pattern discussion a bit
  8:  3e35d62c5ee =  8:  2d2b81986a5 git-sparse-checkout.txt: mark non-cone mode as deprecated
  9:  e7d3ff70914 =  9:  4b89a3392b0 Documentation: some sparsity wording clarifications
-- 
gitgitgadget
Previous: Derrick StoleeNext: Elijah Newren via GitGitGadget
Message 16 of 54 in “sparse-checkout: make cone mode the default”
  1. 0/9 sparse-checkout: make cone mode the defaultElijah Newren via GitGitGadget, Mar 8, 2022
  2. 3/9 git-sparse-checkout.txt: wording updates for the cone mode defaultElijah Newren via GitGitGadget, Mar 8, 2022
  3. 2/9 sparse-checkout: make --cone the defaultElijah Newren via GitGitGadget, Mar 8, 2022
  4. Derrick StoleeMar 8, 2022
  5. Elijah NewrenMar 12, 2022
  6. 1/9 tests: stop assuming --no-cone is the default mode for sparse-checkoutElijah Newren via GitGitGadget, Mar 8, 2022
  7. 4/9 git-sparse-checkout.txt: update docs for deprecation of 'init'Elijah Newren via GitGitGadget, Mar 8, 2022
  8. 5/9 git-sparse-checkout.txt: shuffle some sections and mark as internalElijah Newren via GitGitGadget, Mar 8, 2022
  9. 6/9 git-sparse-checkout.txt: add a new EXAMPLES sectionElijah Newren via GitGitGadget, Mar 8, 2022
  10. Derrick StoleeMar 8, 2022
  11. Elijah NewrenMar 12, 2022
  12. 7/9 git-sparse-checkout.txt: flesh out non-cone mode pattern discussion a bitElijah Newren via GitGitGadget, Mar 8, 2022
  13. 8/9 git-sparse-checkout.txt: mark non-cone mode as deprecatedElijah Newren via GitGitGadget, Mar 8, 2022
  14. 9/9 Documentation: some sparsity wording clarificationsElijah Newren via GitGitGadget, Mar 8, 2022
  15. Derrick StoleeMar 8, 2022
  16. 0/9 sparse-checkout: make cone mode the defaultElijah Newren via GitGitGadget, Mar 12, 2022
  17. 2/9 sparse-checkout: make --cone the defaultElijah Newren via GitGitGadget, Mar 12, 2022
  18. Junio C HamanoMar 14, 2022
  19. Elijah NewrenApr 22, 2022
  20. 1/9 tests: stop assuming --no-cone is the default mode for sparse-checkoutElijah Newren via GitGitGadget, Mar 12, 2022
  21. Junio C HamanoMar 14, 2022
  22. Derrick StoleeMar 15, 2022
  23. 3/9 git-sparse-checkout.txt: wording updates for the cone mode defaultElijah Newren via GitGitGadget, Mar 12, 2022
  24. Junio C HamanoMar 14, 2022
  25. 4/9 git-sparse-checkout.txt: update docs for deprecation of 'init'Elijah Newren via GitGitGadget, Mar 12, 2022
  26. Junio C HamanoMar 14, 2022
  27. Elijah NewrenApr 22, 2022
  28. Junio C HamanoApr 22, 2022
  29. 6/9 git-sparse-checkout.txt: add a new EXAMPLES sectionElijah Newren via GitGitGadget, Mar 12, 2022
  30. 5/9 git-sparse-checkout.txt: shuffle some sections and mark as internalElijah Newren via GitGitGadget, Mar 12, 2022
  31. Junio C HamanoMar 14, 2022
  32. Elijah NewrenApr 22, 2022
  33. 7/9 git-sparse-checkout.txt: flesh out non-cone mode pattern discussion a bitElijah Newren via GitGitGadget, Mar 12, 2022
  34. Junio C HamanoMar 14, 2022
  35. Elijah NewrenApr 22, 2022
  36. 8/9 git-sparse-checkout.txt: mark non-cone mode as deprecatedElijah Newren via GitGitGadget, Mar 12, 2022
  37. Junio C HamanoMar 14, 2022
  38. Elijah NewrenApr 22, 2022
  39. 9/9 Documentation: some sparsity wording clarificationsElijah Newren via GitGitGadget, Mar 12, 2022
  40. Derrick StoleeMar 14, 2022
  41. Victoria DyeMar 14, 2022
  42. Junio C HamanoMar 14, 2022
  43. Junio C HamanoMar 14, 2022
  44. 0/9 sparse-checkout: make cone mode the defaultElijah Newren via GitGitGadget, Apr 22, 2022
  45. 1/9 tests: stop assuming --no-cone is the default mode for sparse-checkoutElijah Newren via GitGitGadget, Apr 22, 2022
  46. 2/9 sparse-checkout: make --cone the defaultElijah Newren via GitGitGadget, Apr 22, 2022
  47. 3/9 git-sparse-checkout.txt: wording updates for the cone mode defaultElijah Newren via GitGitGadget, Apr 22, 2022
  48. 4/9 git-sparse-checkout.txt: update docs for deprecation of 'init'Elijah Newren via GitGitGadget, Apr 22, 2022
  49. 5/9 git-sparse-checkout.txt: shuffle some sections and mark as internalElijah Newren via GitGitGadget, Apr 22, 2022
  50. 9/9 Documentation: some sparsity wording clarificationsElijah Newren via GitGitGadget, Apr 22, 2022
  51. 8/9 git-sparse-checkout.txt: mark non-cone mode as deprecatedElijah Newren via GitGitGadget, Apr 22, 2022
  52. 7/9 git-sparse-checkout.txt: flesh out pattern set sections a bitElijah Newren via GitGitGadget, Apr 22, 2022
  53. 6/9 git-sparse-checkout.txt: add a new EXAMPLES sectionElijah Newren via GitGitGadget, Apr 22, 2022
  54. Derrick StoleeApr 25, 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.