sparse-checkout: make --cone the default

Make cone mode the default, and update the documentation accordingly. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Apr 22, 2022 at 02:32 UTC 2d95707a02ffd68933f8af0fa76090bea908d376
3 files changed +15 -13
Documentation/config/core.txt
+4 -2
@@ -615,8 +615,10 @@ core.sparseCheckout::
615
616 core.sparseCheckoutCone::
617 Enables the "cone mode" of the sparse checkout feature. When the
618 - sparse-checkout file contains a limited set of patterns, then this
619 - mode provides significant performance advantages. See
618 + sparse-checkout file contains a limited set of patterns, this
619 + mode provides significant performance advantages. The "non
620 + cone mode" can be requested to allow specifying a more flexible
621 + patterns by setting this variable to 'false'. See
622 linkgit:git-sparse-checkout[1] for more information.
623
624 core.abbrev::
Documentation/git-sparse-checkout.txt
+10 -10
@@ -22,8 +22,8 @@ present, or undo and go back to having all tracked files present in the
22 working copy.
23
24 The subset of files is chosen by providing a list of directories in
25 -cone mode (which is recommended), or by providing a list of patterns
26 -in non-cone mode.
25 +cone mode (the default), or by providing a list of patterns in
26 +non-cone mode.
27
28 When in a sparse-checkout, other Git commands behave a bit differently.
29 For example, switching branches will not update paths outside the
@@ -60,7 +60,7 @@ When the `--stdin` option is provided, the directories or patterns are
60 read from standard in as a newline-delimited list instead of from the
61 arguments.
62 +
63 -When `--cone` is passed or `core.sparseCheckoutCone` is enabled, the
63 +When `--cone` is passed or `core.sparseCheckoutCone` is not false, the
64 input list is considered a list of directories. This allows for
65 better performance with a limited set of patterns (see 'CONE PATTERN
66 SET' below). The input format matches the output of `git ls-tree
@@ -68,10 +68,9 @@ SET' below). The input format matches the output of `git ls-tree
68 double quote (") as C-style quoted strings. Note that the set command
69 will write patterns to the sparse-checkout file to include all files
70 contained in those directories (recursively) as well as files that are
71 -siblings of ancestor directories. This may become the default in the
72 -future; --no-cone can be passed to request non-cone mode.
71 +siblings of ancestor directories.
72 +
74 -When `--no-cone` is passed or `core.sparseCheckoutCone` is not enabled,
73 +When `--no-cone` is passed or `core.sparseCheckoutCone` is set to false,
74 the input list is considered a list of patterns. This mode is harder
75 to use and less performant, and is thus not recommended. See the
76 "Sparse Checkout" section of linkgit:git-read-tree[1] and the "Pattern
@@ -227,10 +226,11 @@ patterns. The resulting sparse-checkout file is now
226 Here, order matters, so the negative patterns are overridden by the positive
227 patterns that appear lower in the file.
228
230 -If `core.sparseCheckoutCone=true`, then Git will parse the sparse-checkout file
231 -expecting patterns of these types. Git will warn if the patterns do not match.
232 -If the patterns do match the expected format, then Git will use faster hash-
233 -based algorithms to compute inclusion in the sparse-checkout.
229 +Unless `core.sparseCheckoutCone` is explicitly set to `false`, Git will
230 +parse the sparse-checkout file expecting patterns of these types. Git will
231 +warn if the patterns do not match. If the patterns do match the expected
232 +format, then Git will use faster hash-based algorithms to compute inclusion
233 +in the sparse-checkout.
234
235 In the cone mode case, the `git sparse-checkout list` subcommand will list the
236 directories that define the recursive patterns. For the example sparse-checkout
builtin/sparse-checkout.c
+1 -1
@@ -397,7 +397,7 @@ static int update_modes(int *cone_mode, int *sparse_index)
397
398 /* Set cone/non-cone mode appropriately */
399 core_apply_sparse_checkout = 1;
400 - if (*cone_mode == 1) {
400 + if (*cone_mode == 1 || *cone_mode == -1) {
401 mode = MODE_CONE_PATTERNS;
402 core_sparse_checkout_cone = 1;
403 } else {