cocci: refactor common patterns to use xstrdup_or_null()
[git/debian.git] / t / t1090-sparse-checkout-scope.sh
blob1f61eb3e88e30cb2b62040f262a8d24d2758dcfc
1 #!/bin/sh
3 test_description='sparse checkout scope tests'
5 . ./test-lib.sh
7 test_expect_success 'setup' '
8 echo "initial" >a &&
9 echo "initial" >b &&
10 echo "initial" >c &&
11 git add a b c &&
12 git commit -m "initial commit"
15 test_expect_success 'create feature branch' '
16 git checkout -b feature &&
17 echo "modified" >b &&
18 echo "modified" >c &&
19 git add b c &&
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 &&
31 test_path_is_file c
34 test_expect_success 'merge feature branch into sparse checkout of master' '
35 git merge feature &&
36 test_path_is_file a &&
37 test_path_is_missing b &&
38 test_path_is_file c &&
39 test "$(cat c)" = "modified"
42 test_expect_success 'return to full checkout of master' '
43 git checkout feature &&
44 echo "/*" >.git/info/sparse-checkout &&
45 git checkout master &&
46 test_path_is_file a &&
47 test_path_is_file b &&
48 test_path_is_file c &&
49 test "$(cat b)" = "modified"
52 test_done