clone_submodule: avoid using `access()` on directories
[git.git] / t / t6414-merge-rename-nocruft.sh
blob69fc1c9e697a9d86a5d29b2fa99aafbc78a79a6f
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_PASSES_SANITIZE_LEAK=true
8 . ./test-lib.sh
10 test_expect_success 'setup' '
11 cat >A <<-\EOF &&
12 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
13 b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
14 c cccccccccccccccccccccccccccccccccccccccccccccccc
15 d dddddddddddddddddddddddddddddddddddddddddddddddd
16 e eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
17 f ffffffffffffffffffffffffffffffffffffffffffffffff
18 g gggggggggggggggggggggggggggggggggggggggggggggggg
19 h hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
20 i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
21 j jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
22 k kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
23 l llllllllllllllllllllllllllllllllllllllllllllllll
24 m mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
25 n nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
26 o oooooooooooooooooooooooooooooooooooooooooooooooo
27 EOF
29 cat >M <<-\EOF &&
30 A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
31 B BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
32 C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
33 D DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
34 E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
35 F FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
36 G GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
37 H HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
38 I IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
39 J JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
40 K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
41 L LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
42 M MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
43 N NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
44 O OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
45 EOF
47 git add A M &&
48 git commit -m "initial has A and M" &&
49 git branch white &&
50 git branch red &&
51 git branch blue &&
53 git checkout white &&
54 sed -e "/^g /s/.*/g : white changes a line/" <A >B &&
55 sed -e "/^G /s/.*/G : colored branch changes a line/" <M >N &&
56 rm -f A M &&
57 git update-index --add --remove A B M N &&
58 git commit -m "white renames A->B, M->N" &&
60 git checkout red &&
61 echo created by red >R &&
62 git update-index --add R &&
63 git commit -m "red creates R" &&
65 git checkout blue &&
66 sed -e "/^o /s/.*/g : blue changes a line/" <A >B &&
67 rm -f A &&
68 mv B A &&
69 git update-index A &&
70 git commit -m "blue modify A" &&
72 git checkout main
75 # This test broke in 65ac6e9c3f47807cb603af07a6a9e1a43bc119ae
76 test_expect_success 'merge white into red (A->B,M->N)' '
77 git checkout -b red-white red &&
78 git merge white &&
79 git write-tree &&
80 test_path_is_file B &&
81 test_path_is_file N &&
82 test_path_is_file R &&
83 test_path_is_missing A &&
84 test_path_is_missing M
87 # This test broke in 8371234ecaaf6e14fe3f2082a855eff1bbd79ae9
88 test_expect_success 'merge blue into white (A->B, mod A, A untracked)' '
89 git checkout -b white-blue white &&
90 echo dirty >A &&
91 git merge blue &&
92 git write-tree &&
93 test_path_is_file A &&
94 echo dirty >expect &&
95 test_cmp expect A &&
96 test_path_is_file B &&
97 test_path_is_file N &&
98 test_path_is_missing M
101 test_done