3 test_description
='more git add -u'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 test_expect_success setup
'
10 _empty=$(git hash-object --stdin <xyzzy) &&
13 if test_have_prereq SYMLINKS; then
17 printf %s frotz > nitfol &&
22 git add caskly xyzzy yomin nitfol rezrov/bozbar &&
29 test_expect_success modify
'
30 rm -f xyzzy yomin nitfol caskly &&
31 # caskly disappears (not a submodule)
33 # nitfol changes from symlink to regular
35 # rezrov/bozbar disappears
37 if test_have_prereq SYMLINKS; then
40 printf %s xyzzy > rezrov
42 # xyzzy disappears (not a submodule)
44 echo gnusto >xyzzy/bozbar &&
45 # yomin gets replaced with a submodule
52 git commit -m "sub initial"
54 yomin=$(GIT_DIR=yomin/.git git rev-parse HEAD) &&
55 # yonk is added and then turned into a submodule
56 # this should appear as T in diff-files and as A in diff-index
66 git commit -m "sub initial"
68 yonk=$(GIT_DIR=yonk/.git git rev-parse HEAD) &&
69 # zifmia is added and then removed
70 # this should appear in diff-files but not in diff-index.
79 s/ caskly/ $ZERO_OID D&/
83 s/ nitfol/ $ZERO_OID $T_letter&/
87 s/ rezrov.bozbar/ $ZERO_OID D&/
91 s/ xyzzy/ $ZERO_OID D&/
95 s/ yomin/ $ZERO_OID T&/
102 echo ":100644 160000 $_empty $ZERO_OID T yonk" &&
103 echo ":100644 000000 $_empty $ZERO_OID D zifmia"
107 echo ":000000 160000 $ZERO_OID $ZERO_OID A yonk"
110 echo "100644 $_empty 0 nitfol" &&
111 echo "160000 $yomin 0 yomin" &&
112 echo "160000 $yonk 0 yonk"
116 test_expect_success diff-files
'
117 git diff-files --raw >actual &&
118 test_cmp expect-files actual
121 test_expect_success diff-index
'
122 git diff-index --raw HEAD -- >actual &&
123 test_cmp expect-index actual
126 test_expect_success
'add -u' '
127 rm -f ".git/saved-index" &&
128 cp -p ".git/index" ".git/saved-index" &&
130 git ls-files -s >actual &&
131 test_cmp expect-final actual
134 test_expect_success
'commit -a' '
135 if test -f ".git/saved-index"
137 rm -f ".git/index" &&
138 mv ".git/saved-index" ".git/index"
140 git commit -m "second" -a &&
141 git ls-files -s >actual &&
142 test_cmp expect-final actual &&
144 git read-tree HEAD &&
145 git ls-files -s >actual &&
146 test_cmp expect-final actual