don't load objects needlessly when repacking
[git/dkf.git] / t / t6022-merge-rename.sh
blob5ac25647abd366f04867a5acec6a987f314c2ace
1 #!/bin/sh
3 test_description='Merge-recursive merging renames'
4 . ./test-lib.sh
6 if test "$no_python"; then
7 echo "Skipping: no python => no recursive merge"
8 test_done
9 exit 0
12 test_expect_success setup \
14 cat >A <<\EOF &&
15 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
16 b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
17 c cccccccccccccccccccccccccccccccccccccccccccccccc
18 d dddddddddddddddddddddddddddddddddddddddddddddddd
19 e eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
20 f ffffffffffffffffffffffffffffffffffffffffffffffff
21 g gggggggggggggggggggggggggggggggggggggggggggggggg
22 h hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
23 i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
24 j jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
25 k kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
26 l llllllllllllllllllllllllllllllllllllllllllllllll
27 m mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
28 n nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
29 o oooooooooooooooooooooooooooooooooooooooooooooooo
30 EOF
32 cat >M <<\EOF &&
33 A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
34 B BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
35 C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
36 D DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
37 E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
38 F FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
39 G GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
40 H HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
41 I IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
42 J JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
43 K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
44 L LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
45 M MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
46 N NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
47 O OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
48 EOF
50 git add A M &&
51 git commit -m initial &&
52 git branch white &&
53 git branch red &&
54 git branch blue &&
56 sed -e "/^g /s/.*/g : master changes a line/" <A >A+ &&
57 mv A+ A &&
58 git commit -a -m "master updates A" &&
60 git checkout white &&
61 sed -e "/^g /s/.*/g : white changes a line/" <A >B &&
62 sed -e "/^G /s/.*/G : colored branch changes a line/" <M >N &&
63 rm -f A M &&
64 git update-index --add --remove A B M N &&
65 git commit -m "white renames A->B, M->N" &&
67 git checkout red &&
68 sed -e "/^g /s/.*/g : red changes a line/" <A >B &&
69 sed -e "/^G /s/.*/G : colored branch changes a line/" <M >N &&
70 rm -f A M &&
71 git update-index --add --remove A B M N &&
72 git commit -m "red renames A->B, M->N" &&
74 git checkout blue &&
75 sed -e "/^g /s/.*/g : blue changes a line/" <A >C &&
76 sed -e "/^G /s/.*/G : colored branch changes a line/" <M >N &&
77 rm -f A M &&
78 git update-index --add --remove A C M N &&
79 git commit -m "blue renames A->C, M->N" &&
81 git checkout master'
83 test_expect_success 'pull renaming branch into unrenaming one' \
85 git show-branch
86 git pull . white && {
87 echo "BAD: should have conflicted"
88 exit 1
90 git ls-files -s
91 test "$(git ls-files -u B | wc -l)" -eq 3 || {
92 echo "BAD: should have left stages for B"
93 exit 1
95 test "$(git ls-files -s N | wc -l)" -eq 1 || {
96 echo "BAD: should have merged N"
97 exit 1
99 sed -ne "/^g/{
102 }" B | grep master || {
103 echo "BAD: should have listed our change first"
104 exit 1
106 test "$(git diff white N | wc -l)" -eq 0 || {
107 echo "BAD: should have taken colored branch"
108 exit 1
112 test_expect_success 'pull renaming branch into another renaming one' \
114 rm -f B
115 git reset --hard
116 git checkout red
117 git pull . white && {
118 echo "BAD: should have conflicted"
119 exit 1
121 test "$(git ls-files -u B | wc -l)" -eq 3 || {
122 echo "BAD: should have left stages"
123 exit 1
125 test "$(git ls-files -s N | wc -l)" -eq 1 || {
126 echo "BAD: should have merged N"
127 exit 1
129 sed -ne "/^g/{
132 }" B | grep red || {
133 echo "BAD: should have listed our change first"
134 exit 1
136 test "$(git diff white N | wc -l)" -eq 0 || {
137 echo "BAD: should have taken colored branch"
138 exit 1
142 test_expect_success 'pull unrenaming branch into renaming one' \
144 git reset --hard
145 git show-branch
146 git pull . master && {
147 echo "BAD: should have conflicted"
148 exit 1
150 test "$(git ls-files -u B | wc -l)" -eq 3 || {
151 echo "BAD: should have left stages"
152 exit 1
154 test "$(git ls-files -s N | wc -l)" -eq 1 || {
155 echo "BAD: should have merged N"
156 exit 1
158 sed -ne "/^g/{
161 }" B | grep red || {
162 echo "BAD: should have listed our change first"
163 exit 1
165 test "$(git diff white N | wc -l)" -eq 0 || {
166 echo "BAD: should have taken colored branch"
167 exit 1
171 test_expect_success 'pull conflicting renames' \
173 git reset --hard
174 git show-branch
175 git pull . blue && {
176 echo "BAD: should have conflicted"
177 exit 1
179 test "$(git ls-files -u A | wc -l)" -eq 1 || {
180 echo "BAD: should have left a stage"
181 exit 1
183 test "$(git ls-files -u B | wc -l)" -eq 1 || {
184 echo "BAD: should have left a stage"
185 exit 1
187 test "$(git ls-files -u C | wc -l)" -eq 1 || {
188 echo "BAD: should have left a stage"
189 exit 1
191 test "$(git ls-files -s N | wc -l)" -eq 1 || {
192 echo "BAD: should have merged N"
193 exit 1
195 sed -ne "/^g/{
198 }" B | grep red || {
199 echo "BAD: should have listed our change first"
200 exit 1
202 test "$(git diff white N | wc -l)" -eq 0 || {
203 echo "BAD: should have taken colored branch"
204 exit 1
208 test_done