3 test_description='Intent to add'
7 test_expect_success 'intent to add' '
14 test_expect_success 'check result of "add -N"' '
15 git ls-files -s file >actual &&
16 empty=$(git hash-object --stdin </dev/null) &&
17 echo "100644 $empty 0 file" >expect &&
18 test_cmp expect actual
21 test_expect_success 'intent to add is just an ordinary empty blob' '
23 git ls-files -s file >actual &&
24 git ls-files -s elif | sed -e "s/elif/file/" >expect &&
25 test_cmp expect actual
28 test_expect_success 'intent to add does not clobber existing paths' '
29 git add -N file elif &&
30 empty=$(git hash-object --stdin </dev/null) &&
31 git ls-files -s >actual &&
32 ! grep "$empty" actual
35 test_expect_success 'i-t-a entry is simply ignored' '
37 git commit -a -m initial &&
44 git commit -m second &&
45 test $(git ls-tree HEAD -- nitfol | wc -l) = 0 &&
46 test $(git diff --name-only HEAD -- nitfol | wc -l) = 1
49 test_expect_success 'can commit with an unrelated i-t-a entry in index' '
51 echo bozbar >rezrov &&
55 git commit -m partial rezrov
58 test_expect_success 'can "commit -a" with an i-t-a entry' '
65 test_expect_success 'cache-tree invalidates i-t-a paths' '
74 git diff --cached --name-only >actual &&
75 echo dir/bar >expect &&
76 test_cmp expect actual &&
78 git write-tree >/dev/null &&
80 git diff --cached --name-only >actual &&
81 echo dir/bar >expect &&
82 test_cmp expect actual
85 test_expect_success 'cache-tree does not ignore dir that has i-t-a entries' '
86 git init ita-in-dir &&
96 git commit -m committed &&
97 git ls-tree -r HEAD >actual &&
102 test_expect_success 'cache-tree does skip dir that becomes empty' '
104 git init ita-in-dir &&
109 git add -N 1/2/3/4 &&
110 git write-tree >actual &&
111 echo $EMPTY_TREE >expected &&
112 test_cmp expected actual