3 test_description
='more git add -u'
7 _z40
=0000000000000000000000000000000000000000
9 test_expect_success setup
'
11 _empty=$(git hash-object --stdin <xyzzy) &&
14 if test_have_prereq SYMLINKS; then
18 printf %s frotz > nitfol &&
23 git add caskly xyzzy yomin nitfol rezrov/bozbar &&
30 test_expect_success modify
'
31 rm -f xyzzy yomin nitfol caskly &&
32 # caskly disappears (not a submodule)
34 # nitfol changes from symlink to regular
36 # rezrov/bozbar disappears
38 if test_have_prereq SYMLINKS; then
41 printf %s xyzzy > rezrov
43 # xyzzy disappears (not a submodule)
45 echo gnusto >xyzzy/bozbar &&
46 # yomin gets replaced with a submodule
53 git commit -m "sub initial"
55 yomin=$(GIT_DIR=yomin/.git git rev-parse HEAD) &&
56 # yonk is added and then turned into a submodule
57 # this should appear as T in diff-files and as A in diff-index
67 git commit -m "sub initial"
69 yonk=$(GIT_DIR=yonk/.git git rev-parse HEAD) &&
70 # zifmia is added and then removed
71 # this should appear in diff-files but not in diff-index.
84 s/ nitfol/ $_z40 $T_letter&/
88 s/ rezrov.bozbar/ $_z40 D&/
103 echo ":100644 160000 $_empty $_z40 T yonk"
104 echo ":100644 000000 $_empty $_z40 D zifmia"
108 echo ":000000 160000 $_z40 $_z40 A yonk"
111 echo "100644 $_empty 0 nitfol"
112 echo "160000 $yomin 0 yomin"
113 echo "160000 $yonk 0 yonk"
117 test_expect_success diff-files
'
118 git diff-files --raw >actual &&
119 test_cmp expect-files actual
122 test_expect_success diff-index
'
123 git diff-index --raw HEAD -- >actual &&
124 test_cmp expect-index actual
127 test_expect_success
'add -u' '
128 rm -f ".git/saved-index" &&
129 cp -p ".git/index" ".git/saved-index" &&
131 git ls-files -s >actual &&
132 test_cmp expect-final actual
135 test_expect_success
'commit -a' '
136 if test -f ".git/saved-index"
138 rm -f ".git/index" &&
139 mv ".git/saved-index" ".git/index"
141 git commit -m "second" -a &&
142 git ls-files -s >actual &&
143 test_cmp expect-final actual &&
145 git read-tree HEAD &&
146 git ls-files -s >actual &&
147 test_cmp expect-final actual