Skip to content

Commit 16069e2

Browse files
committed
Merge branch 'en/sparse-cone-becomes-default' into seen
Deprecate non-cone mode of the sparse-checkout feature. * en/sparse-cone-becomes-default: Documentation: some sparsity wording clarifications git-sparse-checkout.txt: mark non-cone mode as deprecated git-sparse-checkout.txt: flesh out pattern set sections a bit git-sparse-checkout.txt: add a new EXAMPLES section git-sparse-checkout.txt: shuffle some sections and mark as internal git-sparse-checkout.txt: update docs for deprecation of 'init' git-sparse-checkout.txt: wording updates for the cone mode default sparse-checkout: make --cone the default tests: stop assuming --no-cone is the default mode for sparse-checkout
2 parents 6978ec5 + 5d4b293 commit 16069e2

10 files changed

+268
-101
lines changed

Documentation/config/core.txt

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

707707
core.sparseCheckoutCone::
708708
Enables the "cone mode" of the sparse checkout feature. When the
709-
sparse-checkout file contains a limited set of patterns, then this
710-
mode provides significant performance advantages. See
709+
sparse-checkout file contains a limited set of patterns, this
710+
mode provides significant performance advantages. The "non
711+
cone mode" can be requested to allow specifying a more flexible
712+
patterns by setting this variable to 'false'. See
711713
linkgit:git-sparse-checkout[1] for more information.
712714

713715
core.abbrev::

Documentation/git-read-tree.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,13 @@ have finished your work-in-progress), attempt the merge again.
375375
SPARSE CHECKOUT
376376
---------------
377377

378-
Note: The `update-index` and `read-tree` primitives for supporting the
379-
skip-worktree bit predated the introduction of
380-
linkgit:git-sparse-checkout[1]. Users are encouraged to use
381-
`sparse-checkout` in preference to these low-level primitives.
378+
Note: The skip-worktree capabilities in linkgit:git-update-index[1]
379+
and `read-tree` predated the introduction of
380+
linkgit:git-sparse-checkout[1]. Users are encouraged to use the
381+
`sparse-checkout` command in preference to these plumbing commands for
382+
sparse-checkout/skip-worktree related needs. However, the information
383+
below might be useful to users trying to understand the pattern style
384+
used in non-cone mode of the `sparse-checkout` command.
382385

383386
"Sparse checkout" allows populating the working directory sparsely.
384387
It uses the skip-worktree bit (see linkgit:git-update-index[1]) to

Documentation/git-sparse-checkout.txt

Lines changed: 239 additions & 78 deletions
Large diffs are not rendered by default.

builtin/sparse-checkout.c

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

396396
/* Set cone/non-cone mode appropriately */
397397
core_apply_sparse_checkout = 1;
398-
if (*cone_mode == 1) {
398+
if (*cone_mode == 1 || *cone_mode == -1) {
399399
mode = MODE_CONE_PATTERNS;
400400
core_sparse_checkout_cone = 1;
401401
} else {

t/t1091-sparse-checkout-builtin.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ test_expect_success 'git sparse-checkout list (populated)' '
7272
'
7373

7474
test_expect_success 'git sparse-checkout init' '
75-
git -C repo sparse-checkout init &&
75+
git -C repo sparse-checkout init --no-cone &&
7676
cat >expect <<-\EOF &&
7777
/*
7878
!/*/
@@ -111,6 +111,7 @@ test_expect_success 'init with existing sparse-checkout' '
111111

112112
test_expect_success 'clone --sparse' '
113113
git clone --sparse "file://$(pwd)/repo" clone &&
114+
git -C clone sparse-checkout reapply --no-cone &&
114115
git -C clone sparse-checkout list >actual &&
115116
cat >expect <<-\EOF &&
116117
/*
@@ -124,7 +125,7 @@ test_expect_success 'switching to cone mode with non-cone mode patterns' '
124125
git init bad-patterns &&
125126
(
126127
cd bad-patterns &&
127-
git sparse-checkout init &&
128+
git sparse-checkout init --no-cone &&
128129
git sparse-checkout add dir &&
129130
git config --worktree core.sparseCheckoutCone true &&
130131
test_must_fail git sparse-checkout add dir 2>err &&
@@ -402,7 +403,7 @@ test_expect_success 'revert to old sparse-checkout on empty update' '
402403
git sparse-checkout set nothing 2>err &&
403404
test_i18ngrep ! "Sparse checkout leaves no entry on working directory" err &&
404405
test_i18ngrep ! ".git/index.lock" err &&
405-
git sparse-checkout set file
406+
git sparse-checkout set --no-cone file
406407
)
407408
'
408409

@@ -424,7 +425,7 @@ test_expect_success 'sparse-checkout (init|set|disable) warns with dirty status'
424425
git clone repo dirty &&
425426
echo dirty >dirty/folder1/a &&
426427
427-
git -C dirty sparse-checkout init 2>err &&
428+
git -C dirty sparse-checkout init --no-cone 2>err &&
428429
test_i18ngrep "warning.*The following paths are not up to date" err &&
429430
430431
git -C dirty sparse-checkout set /folder2/* /deep/deeper1/* 2>err &&
@@ -435,7 +436,7 @@ test_expect_success 'sparse-checkout (init|set|disable) warns with dirty status'
435436
test_must_be_empty err &&
436437
437438
git -C dirty reset --hard &&
438-
git -C dirty sparse-checkout init &&
439+
git -C dirty sparse-checkout init --no-cone &&
439440
git -C dirty sparse-checkout set /folder2/* /deep/deeper1/* &&
440441
test_path_is_missing dirty/folder1/a &&
441442
git -C dirty sparse-checkout disable &&
@@ -451,7 +452,7 @@ test_expect_success 'sparse-checkout (init|set|disable) warns with unmerged stat
451452
EOF
452453
git -C unmerged update-index --index-info <input &&
453454
454-
git -C unmerged sparse-checkout init 2>err &&
455+
git -C unmerged sparse-checkout init --no-cone 2>err &&
455456
test_i18ngrep "warning.*The following paths are unmerged" err &&
456457
457458
git -C unmerged sparse-checkout set /folder2/* /deep/deeper1/* 2>err &&
@@ -462,7 +463,7 @@ test_expect_success 'sparse-checkout (init|set|disable) warns with unmerged stat
462463
test_i18ngrep "warning.*The following paths are unmerged" err &&
463464
464465
git -C unmerged reset --hard &&
465-
git -C unmerged sparse-checkout init &&
466+
git -C unmerged sparse-checkout init --no-cone &&
466467
git -C unmerged sparse-checkout set /folder2/* /deep/deeper1/* &&
467468
git -C unmerged sparse-checkout disable
468469
'

t/t3602-rm-sparse-checkout.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ test_expect_success 'setup' "
3030
for opt in "" -f --dry-run
3131
do
3232
test_expect_success "rm${opt:+ $opt} does not remove sparse entries" '
33-
git sparse-checkout set a &&
33+
git sparse-checkout set --no-cone a &&
3434
test_must_fail git rm $opt b 2>stderr &&
3535
test_cmp b_error_and_hint stderr &&
3636
git ls-files --error-unmatch b
@@ -118,7 +118,7 @@ test_expect_success 'can remove files from non-sparse dir' '
118118
test_commit w/f &&
119119
test_commit x/y/f &&
120120
121-
git sparse-checkout set w !/x y/ &&
121+
git sparse-checkout set --no-cone w !/x y/ &&
122122
git rm w/f.t x/y/f.t 2>stderr &&
123123
test_must_be_empty stderr
124124
'
@@ -128,7 +128,7 @@ test_expect_success 'refuse to remove non-skip-worktree file from sparse dir' '
128128
git sparse-checkout disable &&
129129
mkdir -p x/y/z &&
130130
test_commit x/y/z/f &&
131-
git sparse-checkout set !/x y/ !x/y/z &&
131+
git sparse-checkout set --no-cone !/x y/ !x/y/z &&
132132
133133
git update-index --no-skip-worktree x/y/z/f.t &&
134134
test_must_fail git rm x/y/z/f.t 2>stderr &&

t/t3705-add-sparse-checkout.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ test_expect_success 'do not warn when pathspec matches dense entries' '
166166
test_expect_success 'git add fails outside of sparse-checkout definition' '
167167
test_when_finished git sparse-checkout disable &&
168168
test_commit a &&
169-
git sparse-checkout init &&
169+
git sparse-checkout init --no-cone &&
170170
git sparse-checkout set a &&
171171
echo >>sparse_entry &&
172172
@@ -208,7 +208,7 @@ test_expect_success 'add obeys advice.updateSparsePath' '
208208
'
209209

210210
test_expect_success 'add allows sparse entries with --sparse' '
211-
git sparse-checkout set a &&
211+
git sparse-checkout set --no-cone a &&
212212
echo modified >sparse_entry &&
213213
test_must_fail git add sparse_entry &&
214214
test_sparse_entry_unchanged &&

t/t6428-merge-conflicts-sparse.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ test_expect_success 'conflicting entries written to worktree even if sparse' '
8787
test_path_is_file numerals &&
8888
8989
git sparse-checkout init &&
90-
git sparse-checkout set README &&
90+
git sparse-checkout set --no-cone README &&
9191
9292
test_path_is_file README &&
9393
test_path_is_missing numerals &&
@@ -123,7 +123,7 @@ test_expect_success 'present-despite-SKIP_WORKTREE handled reasonably' '
123123
test_path_is_file numerals &&
124124
125125
git sparse-checkout init &&
126-
git sparse-checkout set README &&
126+
git sparse-checkout set --no-cone README &&
127127
128128
test_path_is_file README &&
129129
test_path_is_missing numerals &&

t/t7002-mv-sparse-checkout.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ test_expect_success 'setup' "
2727
test_expect_success 'mv refuses to move sparse-to-sparse' '
2828
test_when_finished rm -f e &&
2929
git reset --hard &&
30-
git sparse-checkout set a &&
30+
git sparse-checkout set --no-cone a &&
3131
touch b &&
3232
test_must_fail git mv b e 2>stderr &&
3333
cat sparse_error_header >expect &&

t/t7012-skip-worktree-writing.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ test_expect_success 'stash restore in sparse checkout' '
151151
152152
git stash push &&
153153
154-
git sparse-checkout set subdir &&
154+
git sparse-checkout set --no-cone subdir &&
155155
156156
# Ensure after sparse-checkout we only have expected files
157157
cat >expect <<-EOF &&

0 commit comments

Comments
 (0)