3 # Copyright (c) 2008 Nguyễn Thái Ngọc Duy
6 test_description
='skip-worktree bit test'
8 TEST_PASSES_SANITIZE_LEAK
=true
11 cat >expect.full
<<EOF
19 cat >expect.skip
<<EOF
29 git update-index
--remove 1 &&
30 git update-index
--add --cacheinfo 100644 $EMPTY_BLOB 1 &&
31 git update-index
--skip-worktree 1
35 echo "100644 $EMPTY_BLOB 0 1" >expected
&&
36 git ls-files
--stage 1 >result
&&
37 test_cmp expected result
&&
42 git update-index
--force-remove 1 &&
44 git update-index
--add --cacheinfo 100644 $EMPTY_BLOB 1 &&
45 git update-index
--skip-worktree 1
49 echo "100644 $EMPTY_BLOB 0 1" >expected
&&
50 git ls-files
--stage 1 >result
&&
51 test_cmp expected result
&&
56 test_expect_success
'setup' '
59 touch ./1 ./2 sub/1 sub/2 &&
60 git add 1 2 sub/1 sub/2 &&
61 git update-index --skip-worktree 1 sub/1 &&
62 git ls-files -t >result &&
63 test_cmp expect.skip result
66 test_expect_success
'update-index' '
72 test_expect_success
'update-index' '
78 test_expect_success
'update-index --remove' '
80 git update-index --remove 1 &&
81 test -z "$(git ls-files 1)" &&
85 test_expect_success
'update-index --remove' '
87 git update-index --remove 1 &&
88 test -z "$(git ls-files 1)" &&
89 echo dirty >expected &&
93 test_expect_success
'ls-files --deleted' '
95 test -z "$(git ls-files -d)"
98 test_expect_success
'ls-files --deleted' '
100 test -z "$(git ls-files -d)"
103 test_expect_success
'ls-files --modified' '
105 test -z "$(git ls-files -m)"
108 test_expect_success
'ls-files --modified' '
110 test -z "$(git ls-files -m)"
113 echo ":000000 100644 $ZERO_OID $EMPTY_BLOB A 1" >expected
114 test_expect_success
'diff-index does not examine skip-worktree absent entries' '
116 git diff-index HEAD -- 1 >result &&
117 test_cmp expected result
120 test_expect_success
'diff-index does not examine skip-worktree dirty entries' '
122 git diff-index HEAD -- 1 >result &&
123 test_cmp expected result
126 test_expect_success
'diff-files does not examine skip-worktree absent entries' '
128 test -z "$(git diff-files -- one)"
131 test_expect_success
'diff-files does not examine skip-worktree dirty entries' '
133 test -z "$(git diff-files -- one)"
136 test_expect_success
'commit on skip-worktree absent entries' '
139 test_must_fail git commit -m null 1
142 test_expect_success
'commit on skip-worktree dirty entries' '
145 test_must_fail git commit -m null 1