Skip to content

Commit dde1358

Browse files
newrengitster
authored andcommitted
tests: stop assuming --no-cone is the default mode for sparse-checkout
Add an explicit --no-cone to several sparse-checkout invocations in preparation for changing the default to cone mode. Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1a48745 commit dde1358

6 files changed

+17
-16
lines changed

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)