3 test_description='sparse checkout builtin tests'
7 test_expect_success 'setup' '
12 mkdir folder1 folder2 deep &&
13 mkdir deep/deeper1 deep/deeper2 &&
14 mkdir deep/deeper1/deepest &&
20 cp a deep/deeper1/deepest &&
22 git commit -m "initial commit"
26 test_expect_success 'git sparse-checkout list (empty)' '
27 git -C repo sparse-checkout list >list 2>err &&
28 test_must_be_empty list &&
29 test_i18ngrep "this worktree is not sparse (sparse-checkout file may not exist)" err
32 test_expect_success 'git sparse-checkout list (populated)' '
33 test_when_finished rm -f repo/.git/info/sparse-checkout &&
34 cat >repo/.git/info/sparse-checkout <<-EOF &&
40 cp repo/.git/info/sparse-checkout expect &&
41 git -C repo sparse-checkout list >list &&
45 test_expect_success 'git sparse-checkout init' '
46 git -C repo sparse-checkout init &&
51 test_cmp expect repo/.git/info/sparse-checkout &&
52 test_cmp_config -C repo true core.sparsecheckout &&
58 test_expect_success 'git sparse-checkout list after init' '
59 git -C repo sparse-checkout list >actual &&
64 test_cmp expect actual
67 test_expect_success 'init with existing sparse-checkout' '
68 echo "*folder*" >> repo/.git/info/sparse-checkout &&
69 git -C repo sparse-checkout init &&
75 test_cmp expect repo/.git/info/sparse-checkout &&
85 test_expect_success 'clone --sparse' '
86 git clone --sparse repo clone &&
87 git -C clone sparse-checkout list >actual &&
92 test_cmp expect actual &&