3 test_description
='Intent to add'
7 test_expect_success
'intent to add' '
18 test_expect_success
'git status' '
19 git status --porcelain | grep -v actual >actual &&
20 cat >expect <<-\EOF &&
25 test_cmp expect actual
28 test_expect_success
'check result of "add -N"' '
29 git ls-files -s file >actual &&
30 empty=$(git hash-object --stdin </dev/null) &&
31 echo "100644 $empty 0 file" >expect &&
32 test_cmp expect actual
35 test_expect_success
'intent to add is just an ordinary empty blob' '
37 git ls-files -s file >actual &&
38 git ls-files -s elif | sed -e "s/elif/file/" >expect &&
39 test_cmp expect actual
42 test_expect_success
'intent to add does not clobber existing paths' '
43 git add -N file elif &&
44 empty=$(git hash-object --stdin </dev/null) &&
45 git ls-files -s >actual &&
46 ! grep "$empty" actual
49 test_expect_success
'i-t-a entry is simply ignored' '
51 git commit -a -m initial &&
58 git commit -m second &&
59 test $(git ls-tree HEAD -- nitfol | wc -l) = 0 &&
60 test $(git diff --name-only HEAD -- nitfol | wc -l) = 1
63 test_expect_success
'can commit with an unrelated i-t-a entry in index' '
65 echo bozbar >rezrov &&
69 git commit -m partial rezrov
72 test_expect_success
'can "commit -a" with an i-t-a entry' '
79 test_expect_success
'cache-tree invalidates i-t-a paths' '
88 git diff --cached --name-only >actual &&
89 echo dir/bar >expect &&
90 test_cmp expect actual &&
92 git write-tree >/dev/null &&
94 git diff --cached --name-only >actual &&
95 echo dir/bar >expect &&
96 test_cmp expect actual
99 test_expect_success
'cache-tree does not ignore dir that has i-t-a entries' '
100 git init ita-in-dir &&
110 git commit -m committed &&
111 git ls-tree -r HEAD >actual &&
116 test_expect_success
'cache-tree does skip dir that becomes empty' '
118 git init ita-in-dir &&
123 git add -N 1/2/3/4 &&
124 git write-tree >actual &&
125 echo $EMPTY_TREE >expected &&
126 test_cmp expected actual