Merge branch 'ab/make-sparse-for-real'
[git/debian.git] / t / t6414-merge-rename-nocruft.sh
blobd7e3c1fa6e634878e24edf0cf9a71e4f07c4733e
1 #!/bin/sh
3 test_description='Merge-recursive merging renames'
4 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7 . ./test-lib.sh
9 test_expect_success 'setup' '
10 cat >A <<-\EOF &&
11 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
12 b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
13 c cccccccccccccccccccccccccccccccccccccccccccccccc
14 d dddddddddddddddddddddddddddddddddddddddddddddddd
15 e eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
16 f ffffffffffffffffffffffffffffffffffffffffffffffff
17 g gggggggggggggggggggggggggggggggggggggggggggggggg
18 h hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
19 i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
20 j jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
21 k kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
22 l llllllllllllllllllllllllllllllllllllllllllllllll
23 m mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
24 n nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
25 o oooooooooooooooooooooooooooooooooooooooooooooooo
26 EOF
28 cat >M <<-\EOF &&
29 A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
30 B BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
31 C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
32 D DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
33 E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
34 F FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
35 G GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
36 H HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
37 I IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
38 J JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
39 K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
40 L LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
41 M MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
42 N NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
43 O OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
44 EOF
46 git add A M &&
47 git commit -m "initial has A and M" &&
48 git branch white &&
49 git branch red &&
50 git branch blue &&
52 git checkout white &&
53 sed -e "/^g /s/.*/g : white changes a line/" <A >B &&
54 sed -e "/^G /s/.*/G : colored branch changes a line/" <M >N &&
55 rm -f A M &&
56 git update-index --add --remove A B M N &&
57 git commit -m "white renames A->B, M->N" &&
59 git checkout red &&
60 echo created by red >R &&
61 git update-index --add R &&
62 git commit -m "red creates R" &&
64 git checkout blue &&
65 sed -e "/^o /s/.*/g : blue changes a line/" <A >B &&
66 rm -f A &&
67 mv B A &&
68 git update-index A &&
69 git commit -m "blue modify A" &&
71 git checkout main
74 # This test broke in 65ac6e9c3f47807cb603af07a6a9e1a43bc119ae
75 test_expect_success 'merge white into red (A->B,M->N)' '
76 git checkout -b red-white red &&
77 git merge white &&
78 git write-tree &&
79 test_path_is_file B &&
80 test_path_is_file N &&
81 test_path_is_file R &&
82 test_path_is_missing A &&
83 test_path_is_missing M
86 # This test broke in 8371234ecaaf6e14fe3f2082a855eff1bbd79ae9
87 test_expect_success 'merge blue into white (A->B, mod A, A untracked)' '
88 git checkout -b white-blue white &&
89 echo dirty >A &&
90 git merge blue &&
91 git write-tree &&
92 test_path_is_file A &&
93 echo dirty >expect &&
94 test_cmp expect A &&
95 test_path_is_file B &&
96 test_path_is_file N &&
97 test_path_is_missing M
100 test_done