t9001: send-email interation with --in-reply-to and --chain-reply-to
[git/kirr.git] / t / t7011-skip-worktree-reading.sh
blobbb4066f76762520b98caeba1cddaf442d80a4bf2
1 #!/bin/sh
3 # Copyright (c) 2008 Nguyễn Thái Ngọc Duy
6 test_description='skip-worktree bit test'
8 . ./test-lib.sh
10 cat >expect.full <<EOF
11 H 1
12 H 2
13 H init.t
14 H sub/1
15 H sub/2
16 EOF
18 cat >expect.skip <<EOF
19 S 1
20 H 2
21 H init.t
22 S sub/1
23 H sub/2
24 EOF
26 NULL_SHA1=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
27 ZERO_SHA0=0000000000000000000000000000000000000000
28 setup_absent() {
29 test -f 1 && rm 1
30 git update-index --remove 1 &&
31 git update-index --add --cacheinfo 100644 $NULL_SHA1 1 &&
32 git update-index --skip-worktree 1
35 test_absent() {
36 echo "100644 $NULL_SHA1 0 1" > expected &&
37 git ls-files --stage 1 > result &&
38 test_cmp expected result &&
39 test ! -f 1
42 setup_dirty() {
43 git update-index --force-remove 1 &&
44 echo dirty > 1 &&
45 git update-index --add --cacheinfo 100644 $NULL_SHA1 1 &&
46 git update-index --skip-worktree 1
49 test_dirty() {
50 echo "100644 $NULL_SHA1 0 1" > expected &&
51 git ls-files --stage 1 > result &&
52 test_cmp expected result &&
53 echo dirty > expected
54 test_cmp expected 1
57 test_expect_success 'setup' '
58 test_commit init &&
59 mkdir sub &&
60 touch ./1 ./2 sub/1 sub/2 &&
61 git add 1 2 sub/1 sub/2 &&
62 git update-index --skip-worktree 1 sub/1 &&
63 git ls-files -t > result &&
64 test_cmp expect.skip result
67 test_expect_success 'update-index' '
68 setup_absent &&
69 git update-index 1 &&
70 test_absent
73 test_expect_success 'update-index' '
74 setup_dirty &&
75 git update-index 1 &&
76 test_dirty
79 test_expect_success 'update-index --remove' '
80 setup_absent &&
81 git update-index --remove 1 &&
82 test -z "$(git ls-files 1)" &&
83 test ! -f 1
86 test_expect_success 'update-index --remove' '
87 setup_dirty &&
88 git update-index --remove 1 &&
89 test -z "$(git ls-files 1)" &&
90 echo dirty > expected &&
91 test_cmp expected 1
94 test_expect_success 'ls-files --delete' '
95 setup_absent &&
96 test -z "$(git ls-files -d)"
99 test_expect_success 'ls-files --delete' '
100 setup_dirty &&
101 test -z "$(git ls-files -d)"
104 test_expect_success 'ls-files --modified' '
105 setup_absent &&
106 test -z "$(git ls-files -m)"
109 test_expect_success 'ls-files --modified' '
110 setup_dirty &&
111 test -z "$(git ls-files -m)"
114 test_expect_success 'grep with skip-worktree file' '
115 git update-index --no-skip-worktree 1 &&
116 echo test > 1 &&
117 git update-index 1 &&
118 git update-index --skip-worktree 1 &&
119 rm 1 &&
120 test "$(git grep --no-ext-grep test)" = "1:test"
123 echo ":000000 100644 $ZERO_SHA0 $NULL_SHA1 A 1" > expected
124 test_expect_success 'diff-index does not examine skip-worktree absent entries' '
125 setup_absent &&
126 git diff-index HEAD -- 1 > result &&
127 test_cmp expected result
130 test_expect_success 'diff-index does not examine skip-worktree dirty entries' '
131 setup_dirty &&
132 git diff-index HEAD -- 1 > result &&
133 test_cmp expected result
136 test_expect_success 'diff-files does not examine skip-worktree absent entries' '
137 setup_absent &&
138 test -z "$(git diff-files -- one)"
141 test_expect_success 'diff-files does not examine skip-worktree dirty entries' '
142 setup_dirty &&
143 test -z "$(git diff-files -- one)"
146 test_expect_success 'git-rm succeeds on skip-worktree absent entries' '
147 setup_absent &&
148 git rm 1
151 test_expect_success 'commit on skip-worktree absent entries' '
152 git reset &&
153 setup_absent &&
154 test_must_fail git commit -m null 1
157 test_expect_success 'commit on skip-worktree dirty entries' '
158 git reset &&
159 setup_dirty &&
160 test_must_fail git commit -m null 1
163 test_done