Skip to content

Commit 2d95707

Browse files
newrengitster
authored andcommitted
sparse-checkout: make --cone the default
Make cone mode the default, and update the documentation accordingly. Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent dde1358 commit 2d95707

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

Documentation/config/core.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,8 +615,10 @@ core.sparseCheckout::
615615

616616
core.sparseCheckoutCone::
617617
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
620622
linkgit:git-sparse-checkout[1] for more information.
621623

622624
core.abbrev::

Documentation/git-sparse-checkout.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ present, or undo and go back to having all tracked files present in the
2222
working copy.
2323

2424
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.
2727

2828
When in a sparse-checkout, other Git commands behave a bit differently.
2929
For example, switching branches will not update paths outside the
@@ -60,18 +60,17 @@ When the `--stdin` option is provided, the directories or patterns are
6060
read from standard in as a newline-delimited list instead of from the
6161
arguments.
6262
+
63-
When `--cone` is passed or `core.sparseCheckoutCone` is enabled, the
63+
When `--cone` is passed or `core.sparseCheckoutCone` is not false, the
6464
input list is considered a list of directories. This allows for
6565
better performance with a limited set of patterns (see 'CONE PATTERN
6666
SET' below). The input format matches the output of `git ls-tree
6767
--name-only`. This includes interpreting pathnames that begin with a
6868
double quote (") as C-style quoted strings. Note that the set command
6969
will write patterns to the sparse-checkout file to include all files
7070
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.
7372
+
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,
7574
the input list is considered a list of patterns. This mode is harder
7675
to use and less performant, and is thus not recommended. See the
7776
"Sparse Checkout" section of linkgit:git-read-tree[1] and the "Pattern
@@ -227,10 +226,11 @@ patterns. The resulting sparse-checkout file is now
227226
Here, order matters, so the negative patterns are overridden by the positive
228227
patterns that appear lower in the file.
229228

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.
234234

235235
In the cone mode case, the `git sparse-checkout list` subcommand will list the
236236
directories that define the recursive patterns. For the example sparse-checkout

builtin/sparse-checkout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ static int update_modes(int *cone_mode, int *sparse_index)
397397

398398
/* Set cone/non-cone mode appropriately */
399399
core_apply_sparse_checkout = 1;
400-
if (*cone_mode == 1) {
400+
if (*cone_mode == 1 || *cone_mode == -1) {
401401
mode = MODE_CONE_PATTERNS;
402402
core_sparse_checkout_cone = 1;
403403
} else {

0 commit comments

Comments
 (0)