1#!/bin/sh
2
3test_description='Merge-recursive merging renames'
4. ./test-lib.sh
5
6test_expect_success setup \
7'
8cat >A <<\EOF &&
9a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
10b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
11c cccccccccccccccccccccccccccccccccccccccccccccccc
12d dddddddddddddddddddddddddddddddddddddddddddddddd
13e eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
14f ffffffffffffffffffffffffffffffffffffffffffffffff
15g gggggggggggggggggggggggggggggggggggggggggggggggg
16h hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
17i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
18j jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
19k kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
20l llllllllllllllllllllllllllllllllllllllllllllllll
21m mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
22n nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
23o oooooooooooooooooooooooooooooooooooooooooooooooo
24EOF
25
26cat >M <<\EOF &&
27A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
28B BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
29C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
30D DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
31E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
32F FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
33G GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
34H HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
35I IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
36J JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
37K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
38L LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
39M MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
40N NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
41O OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
42EOF
43
44git add A M &&
45git commit -m "initial has A and M" &&
46git branch white &&
47git branch red &&
48
49git checkout white &&
50sed -e "/^g /s/.*/g : white changes a line/" <A >B &&
51sed -e "/^G /s/.*/G : colored branch changes a line/" <M >N &&
52rm -f A M &&
53git update-index --add --remove A B M N &&
54git commit -m "white renames A->B, M->N" &&
55
56git checkout red &&
57echo created by red >R &&
58git update-index --add R &&
59git commit -m "red creates R" &&
60
61git checkout master'
62
63# This test broke in 65ac6e9c3f47807cb603af07a6a9e1a43bc119ae
64test_expect_success 'merge white into red (A->B,M->N)' \
65'
66 git checkout -b red-white red &&
67 git merge white &&
68 git write-tree >/dev/null || {
69 echo "BAD: merge did not complete"
70 return 1
71 }
72
73 test -f B || {
74 echo "BAD: B does not exist in working directory"
75 return 1
76 }
77 test -f N || {
78 echo "BAD: N does not exist in working directory"
79 return 1
80 }
81 test -f R || {
82 echo "BAD: R does not exist in working directory"
83 return 1
84 }
85
86 test -f A && {
87 echo "BAD: A still exists in working directory"
88 return 1
89 }
90 test -f M && {
91 echo "BAD: M still exists in working directory"
92 return 1
93 }
94 return 0
95'
96
97test_done