Git 1.6.6.1
[git/mingw/4msysgit/kblees.git] / t / t6034-merge-rename-nocruft.sh
blob65be95fbaaef4861189a7fc6b3a25bb6d7feb0a7
1 #!/bin/sh
3 test_description='Merge-recursive merging renames'
4 . ./test-lib.sh
6 test_expect_success setup \
8 cat >A <<\EOF &&
9 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
10 b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
11 c cccccccccccccccccccccccccccccccccccccccccccccccc
12 d dddddddddddddddddddddddddddddddddddddddddddddddd
13 e eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
14 f ffffffffffffffffffffffffffffffffffffffffffffffff
15 g gggggggggggggggggggggggggggggggggggggggggggggggg
16 h hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
17 i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
18 j jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
19 k kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
20 l llllllllllllllllllllllllllllllllllllllllllllllll
21 m mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
22 n nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
23 o oooooooooooooooooooooooooooooooooooooooooooooooo
24 EOF
26 cat >M <<\EOF &&
27 A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
28 B BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
29 C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
30 D DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
31 E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
32 F FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
33 G GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
34 H HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
35 I IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
36 J JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
37 K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
38 L LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
39 M MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
40 N NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
41 O OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
42 EOF
44 git add A M &&
45 git commit -m "initial has A and M" &&
46 git branch white &&
47 git branch red &&
48 git branch blue &&
50 git checkout white &&
51 sed -e "/^g /s/.*/g : white changes a line/" <A >B &&
52 sed -e "/^G /s/.*/G : colored branch changes a line/" <M >N &&
53 rm -f A M &&
54 git update-index --add --remove A B M N &&
55 git commit -m "white renames A->B, M->N" &&
57 git checkout red &&
58 echo created by red >R &&
59 git update-index --add R &&
60 git commit -m "red creates R" &&
62 git checkout blue &&
63 sed -e "/^o /s/.*/g : blue changes a line/" <A >B &&
64 rm -f A &&
65 mv B A &&
66 git update-index A &&
67 git commit -m "blue modify A" &&
69 git checkout master'
71 # This test broke in 65ac6e9c3f47807cb603af07a6a9e1a43bc119ae
72 test_expect_success 'merge white into red (A->B,M->N)' \
74 git checkout -b red-white red &&
75 git merge white &&
76 git write-tree >/dev/null || {
77 echo "BAD: merge did not complete"
78 return 1
81 test -f B || {
82 echo "BAD: B does not exist in working directory"
83 return 1
85 test -f N || {
86 echo "BAD: N does not exist in working directory"
87 return 1
89 test -f R || {
90 echo "BAD: R does not exist in working directory"
91 return 1
94 test -f A && {
95 echo "BAD: A still exists in working directory"
96 return 1
98 test -f M && {
99 echo "BAD: M still exists in working directory"
100 return 1
102 return 0
105 # This test broke in 8371234ecaaf6e14fe3f2082a855eff1bbd79ae9
106 test_expect_success 'merge blue into white (A->B, mod A, A untracked)' \
108 git checkout -b white-blue white &&
109 echo dirty >A &&
110 git merge blue &&
111 git write-tree >/dev/null || {
112 echo "BAD: merge did not complete"
113 return 1
116 test -f A || {
117 echo "BAD: A does not exist in working directory"
118 return 1
120 test `cat A` = dirty || {
121 echo "BAD: A content is wrong"
122 return 1
124 test -f B || {
125 echo "BAD: B does not exist in working directory"
126 return 1
128 test -f N || {
129 echo "BAD: N does not exist in working directory"
130 return 1
132 test -f M && {
133 echo "BAD: M still exists in working directory"
134 return 1
136 return 0
139 test_done