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

Re: [PATCH v2 2/9] sparse-checkout: make --cone the default

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 14, 2022, 20:34 UTC
Message-ID
<xmqq8rtcqnnn.fsf@gitster.g>
In-Reply-To
<a53179764bc5d411726a095a587ea728aa9a20d3.1647054681.git.gitgitgadget@gmail.com>
"Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 5 quoted lines
>  The subset of files is chosen by providing a list of directories in
> -cone mode (which is recommended), or by providing a list of patterns
> -in non-cone mode.
> +cone mode (the default), or by providing a list of patterns in
> +non-cone mode.
OK.
Show 7 quoted lines
> @@ -60,7 +60,7 @@ When the `--stdin` option is provided, the directories or patterns are
>  read from standard in as a newline-delimited list instead of from the
>  arguments.
>  +
> -When `--cone` is passed or `core.sparseCheckoutCone` is enabled, the
> +When `--cone` is passed or `core.sparseCheckoutCone` is not false, the
>  input list is considered a list of directories.  This allows for

I expected a change to Documentation/config/core.txt in this step, because the default value for core.sparseCheckoutCone becomes true if unspecified with this step, and the normal expectation by the readers is what is not explicitly set to true is either 'false' or 'unspecified' (when 'unspecified' has its own meaning, like in gitattributes).

Something like this?
diff --git i/Documentation/config/core.txt w/Documentation/config/core.txt
index c04f62a54a..03cf075821 100644
--- i/Documentation/config/core.txt
+++ w/Documentation/config/core.txt
@@ -615,8 +615,10 @@ core.sparseCheckout::
 
 core.sparseCheckoutCone::
 	Enables the "cone mode" of the sparse checkout feature. When the
-	sparse-checkout file contains a limited set of patterns, then this
-	mode provides significant performance advantages. See
+	sparse-checkout file contains a limited set of patterns, this
+	mode provides significant performance advantages. The "non
+	cone mode" can be requested to allow specifying a more flexible
+	patterns by setting this variable to 'false'. See
 	linkgit:git-sparse-checkout[1] for more information.
 
 core.abbrev::

> -When `--no-cone` is passed or `core.sparseCheckoutCone` is not enabled,
> +When `--no-cone` is passed or `core.sparseCheckoutCone` is false,

"is set to 'false'" would make it clearer.

> +If `core.sparseCheckoutCone=true` (set by default or with an explicit
> +`--cone`), then Git will parse the sparse-checkout file expecting

"Unless `core.sparseCheckoutCone` is explicitly set to `false`"
might be clearer, but I am not sure.  It is just that I found the
phrase "set by default" confusing.

>  	/* Set cone/non-cone mode appropriately */
>  	core_apply_sparse_checkout = 1;
> -	if (*cone_mode == 1) {
> +	if (*cone_mode) { /* also handles "not specified" (value of -1) */

The comment is correct, but if we can make the code not to require
such a comment, that would be even better.  Are there very small
number of choke points where we always pass, after parsing
configuration variables and options, that we ought to know which
mode to use before the control comes here, and commit the choice
with "if (cone_mode < 0) cone_mode = 1"?

We see beyond precontext of this hunk an assignment to *cone_mode to
tell the choice we made to our caller.  Shouldn't we be doing the
same in this if/else that still assumes we can get "undecided"?

>  		mode = MODE_CONE_PATTERNS;
>  		core_sparse_checkout_cone = 1;
>  	} else {
Previous: Elijah Newren via GitGitGadgetNext: Elijah Newren
Message 18 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.