3 test_description='sparse checkout scope tests'
7 test_expect_success 'setup' '
12 git commit -m "initial commit"
15 test_expect_success 'create feature branch' '
16 git checkout -b feature &&
20 git commit -m "modification"
23 test_expect_success 'perform sparse checkout of master' '
24 git config --local --bool core.sparsecheckout true &&
25 echo "!/*" >.git/info/sparse-checkout &&
26 echo "/a" >>.git/info/sparse-checkout &&
27 echo "/c" >>.git/info/sparse-checkout &&
28 git checkout master &&
29 test_path_is_file a &&
30 test_path_is_missing b &&
34 test_expect_success 'checkout -b checkout.optimizeNewBranch interaction' '
35 cp .git/info/sparse-checkout .git/info/sparse-checkout.bak &&
37 mv -f .git/info/sparse-checkout.bak .git/info/sparse-checkout
40 echo "/b" >>.git/info/sparse-checkout &&
41 test "$(git ls-files -t b)" = "S b" &&
42 git -c checkout.optimizeNewBranch=true checkout -b fast &&
43 test "$(git ls-files -t b)" = "S b" &&
44 git checkout -b slow &&
45 test "$(git ls-files -t b)" = "H b"
48 test_expect_success 'merge feature branch into sparse checkout of master' '
50 test_path_is_file a &&
51 test_path_is_missing b &&
52 test_path_is_file c &&
53 test "$(cat c)" = "modified"
56 test_expect_success 'return to full checkout of master' '
57 git checkout feature &&
58 echo "/*" >.git/info/sparse-checkout &&
59 git checkout master &&
60 test_path_is_file a &&
61 test_path_is_file b &&
62 test_path_is_file c &&
63 test "$(cat b)" = "modified"