]> git.ipfire.org Git - thirdparty/git.git/blame - t/t2201-add-update-typechange.sh
l10n: it.po: update the Italian translation for Git 2.24.0 round #2
[thirdparty/git.git] / t / t2201-add-update-typechange.sh
CommitLineData
6301f303
JH
1#!/bin/sh
2
3test_description='more git add -u'
4
5. ./test-lib.sh
6
6301f303
JH
7test_expect_success setup '
8 >xyzzy &&
9 _empty=$(git hash-object --stdin <xyzzy) &&
10 >yomin &&
11 >caskly &&
704a3143
JS
12 if test_have_prereq SYMLINKS; then
13 ln -s frotz nitfol &&
14 T_letter=T
15 else
16 printf %s frotz > nitfol &&
17 T_letter=M
18 fi &&
6301f303
JH
19 mkdir rezrov &&
20 >rezrov/bozbar &&
21 git add caskly xyzzy yomin nitfol rezrov/bozbar &&
22
23 test_tick &&
24 git commit -m initial
25
26'
27
28test_expect_success modify '
29 rm -f xyzzy yomin nitfol caskly &&
30 # caskly disappears (not a submodule)
31 mkdir caskly &&
32 # nitfol changes from symlink to regular
33 >nitfol &&
34 # rezrov/bozbar disappears
35 rm -fr rezrov &&
704a3143
JS
36 if test_have_prereq SYMLINKS; then
37 ln -s xyzzy rezrov
38 else
39 printf %s xyzzy > rezrov
40 fi &&
6301f303
JH
41 # xyzzy disappears (not a submodule)
42 mkdir xyzzy &&
43 echo gnusto >xyzzy/bozbar &&
44 # yomin gets replaced with a submodule
45 mkdir yomin &&
46 >yomin/yomin &&
47 (
48 cd yomin &&
49 git init &&
50 git add yomin &&
51 git commit -m "sub initial"
52 ) &&
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
56 >yonk &&
57 git add yonk &&
58 rm -f yonk &&
59 mkdir yonk &&
60 >yonk/yonk &&
61 (
62 cd yonk &&
63 git init &&
64 git add yonk &&
65 git commit -m "sub initial"
66 ) &&
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.
70 >zifmia &&
71 git add zifmia &&
72 rm -f zifmia &&
73 mkdir zifmia &&
74 {
75 git ls-tree -r HEAD |
76 sed -e "s/^/:/" -e "
77 / caskly/{
8125a58b 78 s/ caskly/ $ZERO_OID D&/
6301f303
JH
79 s/blob/000000/
80 }
81 / nitfol/{
8125a58b 82 s/ nitfol/ $ZERO_OID $T_letter&/
6301f303
JH
83 s/blob/100644/
84 }
85 / rezrov.bozbar/{
8125a58b 86 s/ rezrov.bozbar/ $ZERO_OID D&/
6301f303
JH
87 s/blob/000000/
88 }
89 / xyzzy/{
8125a58b 90 s/ xyzzy/ $ZERO_OID D&/
6301f303
JH
91 s/blob/000000/
92 }
93 / yomin/{
8125a58b 94 s/ yomin/ $ZERO_OID T&/
6301f303
JH
95 s/blob/160000/
96 }
97 "
98 } >expect &&
99 {
100 cat expect
8125a58b 101 echo ":100644 160000 $_empty $ZERO_OID T yonk"
102 echo ":100644 000000 $_empty $ZERO_OID D zifmia"
6301f303
JH
103 } >expect-files &&
104 {
105 cat expect
8125a58b 106 echo ":000000 160000 $ZERO_OID $ZERO_OID A yonk"
6301f303
JH
107 } >expect-index &&
108 {
109 echo "100644 $_empty 0 nitfol"
110 echo "160000 $yomin 0 yomin"
111 echo "160000 $yonk 0 yonk"
112 } >expect-final
113'
114
f58dbf23 115test_expect_success diff-files '
6301f303 116 git diff-files --raw >actual &&
2b14d072 117 test_cmp expect-files actual
6301f303
JH
118'
119
948dd346 120test_expect_success diff-index '
6301f303 121 git diff-index --raw HEAD -- >actual &&
2b14d072 122 test_cmp expect-index actual
6301f303
JH
123'
124
f58dbf23 125test_expect_success 'add -u' '
6301f303
JH
126 rm -f ".git/saved-index" &&
127 cp -p ".git/index" ".git/saved-index" &&
128 git add -u &&
129 git ls-files -s >actual &&
2b14d072 130 test_cmp expect-final actual
6301f303
JH
131'
132
f58dbf23 133test_expect_success 'commit -a' '
6301f303
JH
134 if test -f ".git/saved-index"
135 then
136 rm -f ".git/index" &&
137 mv ".git/saved-index" ".git/index"
138 fi &&
139 git commit -m "second" -a &&
140 git ls-files -s >actual &&
2b14d072 141 test_cmp expect-final actual &&
6301f303
JH
142 rm -f .git/index &&
143 git read-tree HEAD &&
144 git ls-files -s >actual &&
2b14d072 145 test_cmp expect-final actual
6301f303
JH
146'
147
148test_done