3 test_description='more git add -u'
7 test_expect_success setup '
9 _empty=$(git hash-object --stdin <xyzzy) &&
12 if test_have_prereq SYMLINKS; then
16 printf %s frotz > nitfol &&
21 git add caskly xyzzy yomin nitfol rezrov/bozbar &&
28 test_expect_success modify '
29 rm -f xyzzy yomin nitfol caskly &&
30 # caskly disappears (not a submodule)
32 # nitfol changes from symlink to regular
34 # rezrov/bozbar disappears
36 if test_have_prereq SYMLINKS; then
39 printf %s xyzzy > rezrov
41 # xyzzy disappears (not a submodule)
43 echo gnusto >xyzzy/bozbar &&
44 # yomin gets replaced with a submodule
51 git commit -m "sub initial"
53 yomin=$(GIT_DIR=yomin/.git git rev-parse HEAD) &&
54 # yonk is added and then turned into a submodule
55 # this should appear as T in diff-files and as A in diff-index
65 git commit -m "sub initial"
67 yonk=$(GIT_DIR=yonk/.git git rev-parse HEAD) &&
68 # zifmia is added and then removed
69 # this should appear in diff-files but not in diff-index.
82 s/ nitfol/ $_z40 $T_letter&/
86 s/ rezrov.bozbar/ $_z40 D&/
101 echo ":100644 160000 $_empty $_z40 T yonk"
102 echo ":100644 000000 $_empty $_z40 D zifmia"
106 echo ":000000 160000 $_z40 $_z40 A yonk"
109 echo "100644 $_empty 0 nitfol"
110 echo "160000 $yomin 0 yomin"
111 echo "160000 $yonk 0 yonk"
115 test_expect_success diff-files '
116 git diff-files --raw >actual &&
117 test_cmp expect-files actual
120 test_expect_success diff-index '
121 git diff-index --raw HEAD -- >actual &&
122 test_cmp expect-index actual
125 test_expect_success 'add -u' '
126 rm -f ".git/saved-index" &&
127 cp -p ".git/index" ".git/saved-index" &&
129 git ls-files -s >actual &&
130 test_cmp expect-final actual
133 test_expect_success 'commit -a' '
134 if test -f ".git/saved-index"
136 rm -f ".git/index" &&
137 mv ".git/saved-index" ".git/index"
139 git commit -m "second" -a &&
140 git ls-files -s >actual &&
141 test_cmp expect-final actual &&
143 git read-tree HEAD &&
144 git ls-files -s >actual &&
145 test_cmp expect-final actual