3 # Copyright (c) 2008 Nguyễn Thái Ngọc Duy
6 test_description='skip-worktree bit test'
10 cat >expect.full <<EOF
18 cat >expect.skip <<EOF
28 git update-index --remove 1 &&
29 git update-index --add --cacheinfo 100644 $EMPTY_BLOB 1 &&
30 git update-index --skip-worktree 1
34 echo "100644 $EMPTY_BLOB 0 1" > expected &&
35 git ls-files --stage 1 > result &&
36 test_cmp expected result &&
41 git update-index --force-remove 1 &&
43 git update-index --add --cacheinfo 100644 $EMPTY_BLOB 1 &&
44 git update-index --skip-worktree 1
48 echo "100644 $EMPTY_BLOB 0 1" > expected &&
49 git ls-files --stage 1 > result &&
50 test_cmp expected result &&
55 test_expect_success 'setup' '
58 touch ./1 ./2 sub/1 sub/2 &&
59 git add 1 2 sub/1 sub/2 &&
60 git update-index --skip-worktree 1 sub/1 &&
61 git ls-files -t > result &&
62 test_cmp expect.skip result
65 test_expect_success 'update-index' '
71 test_expect_success 'update-index' '
77 test_expect_success 'update-index --remove' '
79 git update-index --remove 1 &&
80 test -z "$(git ls-files 1)" &&
84 test_expect_success 'update-index --remove' '
86 git update-index --remove 1 &&
87 test -z "$(git ls-files 1)" &&
88 echo dirty > expected &&
92 test_expect_success 'ls-files --deleted' '
94 test -z "$(git ls-files -d)"
97 test_expect_success 'ls-files --deleted' '
99 test -z "$(git ls-files -d)"
102 test_expect_success 'ls-files --modified' '
104 test -z "$(git ls-files -m)"
107 test_expect_success 'ls-files --modified' '
109 test -z "$(git ls-files -m)"
112 echo ":000000 100644 $ZERO_OID $EMPTY_BLOB A 1" > expected
113 test_expect_success 'diff-index does not examine skip-worktree absent entries' '
115 git diff-index HEAD -- 1 > result &&
116 test_cmp expected result
119 test_expect_success 'diff-index does not examine skip-worktree dirty entries' '
121 git diff-index HEAD -- 1 > result &&
122 test_cmp expected result
125 test_expect_success 'diff-files does not examine skip-worktree absent entries' '
127 test -z "$(git diff-files -- one)"
130 test_expect_success 'diff-files does not examine skip-worktree dirty entries' '
132 test -z "$(git diff-files -- one)"
135 test_expect_success 'commit on skip-worktree absent entries' '
138 test_must_fail git commit -m null 1
141 test_expect_success 'commit on skip-worktree dirty entries' '
144 test_must_fail git commit -m null 1