3 test_description='more git add -u'
7 _z40=0000000000000000000000000000000000000000
9 test_expect_success setup '
11 _empty=$(git hash-object --stdin <xyzzy) &&
17 git add caskly xyzzy yomin nitfol rezrov/bozbar &&
24 test_expect_success modify '
25 rm -f xyzzy yomin nitfol caskly &&
26 # caskly disappears (not a submodule)
28 # nitfol changes from symlink to regular
30 # rezrov/bozbar disappears
33 # xyzzy disappears (not a submodule)
35 echo gnusto >xyzzy/bozbar &&
36 # yomin gets replaced with a submodule
43 git commit -m "sub initial"
45 yomin=$(GIT_DIR=yomin/.git git rev-parse HEAD) &&
46 # yonk is added and then turned into a submodule
47 # this should appear as T in diff-files and as A in diff-index
57 git commit -m "sub initial"
59 yonk=$(GIT_DIR=yonk/.git git rev-parse HEAD) &&
60 # zifmia is added and then removed
61 # this should appear in diff-files but not in diff-index.
78 s/ rezrov.bozbar/ $_z40 D&/
93 echo ":100644 160000 $_empty $_z40 T yonk"
94 echo ":100644 000000 $_empty $_z40 D zifmia"
98 echo ":000000 160000 $_z40 $_z40 A yonk"
101 echo "100644 $_empty 0 nitfol"
102 echo "160000 $yomin 0 yomin"
103 echo "160000 $yonk 0 yonk"
107 test_expect_success diff-files '
108 git diff-files --raw >actual &&
109 test_cmp expect-files actual
112 test_expect_success diff-index '
113 git diff-index --raw HEAD -- >actual &&
114 test_cmp expect-index actual
117 test_expect_success 'add -u' '
118 rm -f ".git/saved-index" &&
119 cp -p ".git/index" ".git/saved-index" &&
121 git ls-files -s >actual &&
122 test_cmp expect-final actual
125 test_expect_success 'commit -a' '
126 if test -f ".git/saved-index"
128 rm -f ".git/index" &&
129 mv ".git/saved-index" ".git/index"
131 git commit -m "second" -a &&
132 git ls-files -s >actual &&
133 test_cmp expect-final actual &&
135 git read-tree HEAD &&
136 git ls-files -s >actual &&
137 test_cmp expect-final actual