t602[1236], t6034: modernize test formatting
Indent code, and include it inside test_expect* blocks. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren committed
Feb 27, 2020 at 00:14 UTC
42d180dd01d5cc2017e6001d8d9dc2b3ee496713
5 files changed
+591
-595
t/t6021-merge-criss-cross.sh
+53
-82
@@ -10,87 +10,58 @@
10
test_description='Test criss-cross merge'
11
. ./test-lib.sh
12
13
-test_expect_success 'prepare repository' \
14
-'echo "1
15
-2
16
-3
17
-4
18
-5
19
-6
20
-7
21
-8
22
-9" > file &&
23
-git add file &&
24
-git commit -m "Initial commit" file &&
25
-git branch A &&
26
-git branch B &&
27
-git checkout A &&
28
-echo "1
29
-2
30
-3
31
-4
32
-5
33
-6
34
-7
35
-8 changed in B8, branch A
36
-9" > file &&
37
-git commit -m "B8" file &&
38
-git checkout B &&
39
-echo "1
40
-2
41
-3 changed in C3, branch B
42
-4
43
-5
44
-6
45
-7
46
-8
47
-9
48
-" > file &&
49
-git commit -m "C3" file &&
50
-git branch C3 &&
51
-git merge -m "pre E3 merge" A &&
52
-echo "1
53
-2
54
-3 changed in E3, branch B. New file size
55
-4
56
-5
57
-6
58
-7
59
-8 changed in B8, branch A
60
-9
61
-" > file &&
62
-git commit -m "E3" file &&
63
-git checkout A &&
64
-git merge -m "pre D8 merge" C3 &&
65
-echo "1
66
-2
67
-3 changed in C3, branch B
68
-4
69
-5
70
-6
71
-7
72
-8 changed in D8, branch A. New file size 2
73
-9" > file &&
74
-git commit -m D8 file'
75
-
76
-test_expect_success 'Criss-cross merge' 'git merge -m "final merge" B'
77
-
78
-cat > file-expect <<EOF
79
-1
80
-2
81
-3 changed in E3, branch B. New file size
82
-4
83
-5
84
-6
85
-7
86
-8 changed in D8, branch A. New file size 2
87
-9
88
-EOF
89
-
90
-test_expect_success 'Criss-cross merge result' 'cmp file file-expect'
91
-
92
-test_expect_success 'Criss-cross merge fails (-s resolve)' \
93
-'git reset --hard A^ &&
94
-test_must_fail git merge -s resolve -m "final merge" B'
13
+test_expect_success 'prepare repository' '
14
+ test_write_lines 1 2 3 4 5 6 7 8 9 >file &&
15
+ git add file &&
16
+ git commit -m "Initial commit" file &&
17
+
18
+ git branch A &&
19
+ git branch B &&
20
+ git checkout A &&
21
+
22
+ test_write_lines 1 2 3 4 5 6 7 "8 changed in B8, branch A" 9 >file &&
23
+ git commit -m "B8" file &&
24
+ git checkout B &&
25
+
26
+ test_write_lines 1 2 "3 changed in C3, branch B" 4 5 6 7 8 9 >file &&
27
+ git commit -m "C3" file &&
28
+ git branch C3 &&
29
+
30
+ git merge -m "pre E3 merge" A &&
31
+
32
+ test_write_lines 1 2 "3 changed in E3, branch B. New file size" 4 5 6 7 "8 changed in B8, branch A" 9 >file &&
33
+ git commit -m "E3" file &&
34
+
35
+ git checkout A &&
36
+ git merge -m "pre D8 merge" C3 &&
37
+ test_write_lines 1 2 "3 changed in C3, branch B" 4 5 6 7 "8 changed in D8, branch A. New file size 2" 9 >file &&
38
+
39
+ git commit -m D8 file
40
+'
41
+
42
+test_expect_success 'Criss-cross merge' '
43
+ git merge -m "final merge" B
44
+'
45
+
46
+test_expect_success 'Criss-cross merge result' '
47
+ cat <<-\EOF >file-expect &&
48
+ 1
49
+ 2
50
+ 3 changed in E3, branch B. New file size
51
+ 4
52
+ 5
53
+ 6
54
+ 7
55
+ 8 changed in D8, branch A. New file size 2
56
+ 9
57
+ EOF
58
+
59
+ test_cmp file-expect file
60
+'
61
+
62
+test_expect_success 'Criss-cross merge fails (-s resolve)' '
63
+ git reset --hard A^ &&
64
+ test_must_fail git merge -s resolve -m "final merge" B
65
+'
66
67
test_done
t/t6022-merge-rename.sh
+157
-158
@@ -8,94 +8,94 @@ modify () {
8
mv "$2.x" "$2"
9
}
10
11
-test_expect_success setup \
12
-'
13
-cat >A <<\EOF &&
14
-a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
15
-b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
16
-c cccccccccccccccccccccccccccccccccccccccccccccccc
17
-d dddddddddddddddddddddddddddddddddddddddddddddddd
18
-e eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
19
-f ffffffffffffffffffffffffffffffffffffffffffffffff
20
-g gggggggggggggggggggggggggggggggggggggggggggggggg
21
-h hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
22
-i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
23
-j jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
24
-k kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
25
-l llllllllllllllllllllllllllllllllllllllllllllllll
26
-m mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
27
-n nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
28
-o oooooooooooooooooooooooooooooooooooooooooooooooo
29
-EOF
30
-
31
-cat >M <<\EOF &&
32
-A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
33
-B BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
34
-C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
35
-D DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
36
-E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
37
-F FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
38
-G GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
39
-H HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
40
-I IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
41
-J JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
42
-K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
43
-L LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
44
-M MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
45
-N NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
46
-O OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
47
-EOF
48
-
49
-git add A M &&
50
-git commit -m "initial has A and M" &&
51
-git branch white &&
52
-git branch red &&
53
-git branch blue &&
54
-git branch yellow &&
55
-git branch change &&
56
-git branch change+rename &&
57
-
58
-sed -e "/^g /s/.*/g : master changes a line/" <A >A+ &&
59
-mv A+ A &&
60
-git commit -a -m "master updates A" &&
61
-
62
-git checkout yellow &&
63
-rm -f M &&
64
-git commit -a -m "yellow removes M" &&
65
-
66
-git checkout white &&
67
-sed -e "/^g /s/.*/g : white changes a line/" <A >B &&
68
-sed -e "/^G /s/.*/G : colored branch changes a line/" <M >N &&
69
-rm -f A M &&
70
-git update-index --add --remove A B M N &&
71
-git commit -m "white renames A->B, M->N" &&
72
-
73
-git checkout red &&
74
-sed -e "/^g /s/.*/g : red changes a line/" <A >B &&
75
-sed -e "/^G /s/.*/G : colored branch changes a line/" <M >N &&
76
-rm -f A M &&
77
-git update-index --add --remove A B M N &&
78
-git commit -m "red renames A->B, M->N" &&
79
-
80
-git checkout blue &&
81
-sed -e "/^g /s/.*/g : blue changes a line/" <A >C &&
82
-sed -e "/^G /s/.*/G : colored branch changes a line/" <M >N &&
83
-rm -f A M &&
84
-git update-index --add --remove A C M N &&
85
-git commit -m "blue renames A->C, M->N" &&
86
-
87
-git checkout change &&
88
-sed -e "/^g /s/.*/g : changed line/" <A >A+ &&
89
-mv A+ A &&
90
-git commit -q -a -m "changed" &&
91
-
92
-git checkout change+rename &&
93
-sed -e "/^g /s/.*/g : changed line/" <A >B &&
94
-rm A &&
95
-git update-index --add B &&
96
-git commit -q -a -m "changed and renamed" &&
97
-
98
-git checkout master'
11
+test_expect_success 'setup' '
12
+ cat >A <<-\EOF &&
13
+ a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
14
+ b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
15
+ c cccccccccccccccccccccccccccccccccccccccccccccccc
16
+ d dddddddddddddddddddddddddddddddddddddddddddddddd
17
+ e eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
18
+ f ffffffffffffffffffffffffffffffffffffffffffffffff
19
+ g gggggggggggggggggggggggggggggggggggggggggggggggg
20
+ h hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
21
+ i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
22
+ j jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
23
+ k kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
24
+ l llllllllllllllllllllllllllllllllllllllllllllllll
25
+ m mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
26
+ n nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
27
+ o oooooooooooooooooooooooooooooooooooooooooooooooo
28
+ EOF
29
+
30
+ cat >M <<-\EOF &&
31
+ A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
32
+ B BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
33
+ C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
34
+ D DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
35
+ E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
36
+ F FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
37
+ G GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
38
+ H HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
39
+ I IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
40
+ J JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
41
+ K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
42
+ L LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
43
+ M MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
44
+ N NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
45
+ O OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
46
+ EOF
47
+
48
+ git add A M &&
49
+ git commit -m "initial has A and M" &&
50
+ git branch white &&
51
+ git branch red &&
52
+ git branch blue &&
53
+ git branch yellow &&
54
+ git branch change &&
55
+ git branch change+rename &&
56
+
57
+ sed -e "/^g /s/.*/g : master changes a line/" <A >A+ &&
58
+ mv A+ A &&
59
+ git commit -a -m "master updates A" &&
60
+
61
+ git checkout yellow &&
62
+ rm -f M &&
63
+ git commit -a -m "yellow removes M" &&
64
+
65
+ git checkout white &&
66
+ sed -e "/^g /s/.*/g : white changes a line/" <A >B &&
67
+ sed -e "/^G /s/.*/G : colored branch changes a line/" <M >N &&
68
+ rm -f A M &&
69
+ git update-index --add --remove A B M N &&
70
+ git commit -m "white renames A->B, M->N" &&
71
+
72
+ git checkout red &&
73
+ sed -e "/^g /s/.*/g : red changes a line/" <A >B &&
74
+ sed -e "/^G /s/.*/G : colored branch changes a line/" <M >N &&
75
+ rm -f A M &&
76
+ git update-index --add --remove A B M N &&
77
+ git commit -m "red renames A->B, M->N" &&
78
+
79
+ git checkout blue &&
80
+ sed -e "/^g /s/.*/g : blue changes a line/" <A >C &&
81
+ sed -e "/^G /s/.*/G : colored branch changes a line/" <M >N &&
82
+ rm -f A M &&
83
+ git update-index --add --remove A C M N &&
84
+ git commit -m "blue renames A->C, M->N" &&
85
+
86
+ git checkout change &&
87
+ sed -e "/^g /s/.*/g : changed line/" <A >A+ &&
88
+ mv A+ A &&
89
+ git commit -q -a -m "changed" &&
90
+
91
+ git checkout change+rename &&
92
+ sed -e "/^g /s/.*/g : changed line/" <A >B &&
93
+ rm A &&
94
+ git update-index --add B &&
95
+ git commit -q -a -m "changed and renamed" &&
96
+
97
+ git checkout master
98
+'
99
100
test_expect_success 'pull renaming branch into unrenaming one' \
101
'
@@ -288,14 +288,15 @@ test_expect_success 'setup for rename + d/f conflicts' '
288
git commit -m "Conflicting change"
289
'
290
291
-printf "1\n2\n3\n4\n5555\n6\n7\n8\n9\n10\n11\n" >expected
292
-
291
test_expect_success 'Rename+D/F conflict; renamed file merges + dir not in way' '
292
git reset --hard &&
293
git checkout -q renamed-file-has-no-conflicts^0 &&
294
+
295
git merge --strategy=recursive dir-not-in-way &&
296
+
297
git diff --quiet &&
298
test -f dir &&
299
+ printf "1\n2\n3\n4\n5555\n6\n7\n8\n9\n10\n11\n" >expected &&
300
test_cmp expected dir
301
'
302
@@ -342,24 +343,6 @@ test_expect_success 'Same as previous, but merged other way' '
343
test_cmp expected dir~renamed-file-has-no-conflicts
344
'
345
345
-cat >expected <<\EOF &&
346
-1
347
-2
348
-3
349
-4
350
-5
351
-6
352
-7
353
-8
354
-9
355
-10
356
-<<<<<<< HEAD:dir
357
-12
358
-=======
359
-11
360
->>>>>>> dir-not-in-way:sub/file
361
-EOF
362
-
346
test_expect_success 'Rename+D/F conflict; renamed file cannot merge, dir not in way' '
347
git reset --hard &&
348
rm -rf dir~* &&
@@ -373,6 +356,23 @@ test_expect_success 'Rename+D/F conflict; renamed file cannot merge, dir not in
356
test_must_fail git diff --cached --quiet &&
357
358
test -f dir &&
359
+ cat >expected <<-\EOF &&
360
+ 1
361
+ 2
362
+ 3
363
+ 4
364
+ 5
365
+ 6
366
+ 7
367
+ 8
368
+ 9
369
+ 10
370
+ <<<<<<< HEAD:dir
371
+ 12
372
+ =======
373
+ 11
374
+ >>>>>>> dir-not-in-way:sub/file
375
+ EOF
376
test_cmp expected dir
377
'
378
@@ -396,24 +396,6 @@ test_expect_success 'Rename+D/F conflict; renamed file cannot merge and dir in t
396
test_cmp expected dir~HEAD
397
'
398
399
-cat >expected <<\EOF &&
400
-1
401
-2
402
-3
403
-4
404
-5
405
-6
406
-7
407
-8
408
-9
409
-10
410
-<<<<<<< HEAD:sub/file
411
-11
412
-=======
413
-12
414
->>>>>>> renamed-file-has-conflicts:dir
415
-EOF
416
-
399
test_expect_success 'Same as previous, but merged other way' '
400
git reset --hard &&
401
rm -rf dir~* &&
@@ -429,6 +411,23 @@ test_expect_success 'Same as previous, but merged other way' '
411
412
test -f dir/file-in-the-way &&
413
test -f dir~renamed-file-has-conflicts &&
414
+ cat >expected <<-\EOF &&
415
+ 1
416
+ 2
417
+ 3
418
+ 4
419
+ 5
420
+ 6
421
+ 7
422
+ 8
423
+ 9
424
+ 10
425
+ <<<<<<< HEAD:sub/file
426
+ 11
427
+ =======
428
+ 12
429
+ >>>>>>> renamed-file-has-conflicts:dir
430
+ EOF
431
test_cmp expected dir~renamed-file-has-conflicts
432
'
433
@@ -810,48 +809,48 @@ test_expect_success 'setup for use of extended merge markers' '
809
git commit -mC
810
'
811
813
-cat >expected <<\EOF &&
814
-1
815
-2
816
-3
817
-4
818
-5
819
-6
820
-7
821
-8
822
-<<<<<<< HEAD:renamed_file
823
-9
824
-=======
825
-8.5
826
->>>>>>> master^0:original_file
827
-EOF
828
-
812
test_expect_success 'merge master into rename has correct extended markers' '
813
git checkout rename^0 &&
814
test_must_fail git merge -s recursive master^0 &&
815
+
816
+ cat >expected <<-\EOF &&
817
+ 1
818
+ 2
819
+ 3
820
+ 4
821
+ 5
822
+ 6
823
+ 7
824
+ 8
825
+ <<<<<<< HEAD:renamed_file
826
+ 9
827
+ =======
828
+ 8.5
829
+ >>>>>>> master^0:original_file
830
+ EOF
831
test_cmp expected renamed_file
832
'
833
835
-cat >expected <<\EOF &&
836
-1
837
-2
838
-3
839
-4
840
-5
841
-6
842
-7
843
-8
844
-<<<<<<< HEAD:original_file
845
-8.5
846
-=======
847
-9
848
->>>>>>> rename^0:renamed_file
849
-EOF
850
-
834
test_expect_success 'merge rename into master has correct extended markers' '
835
git reset --hard &&
836
git checkout master^0 &&
837
test_must_fail git merge -s recursive rename^0 &&
838
+
839
+ cat >expected <<-\EOF &&
840
+ 1
841
+ 2
842
+ 3
843
+ 4
844
+ 5
845
+ 6
846
+ 7
847
+ 8
848
+ <<<<<<< HEAD:original_file
849
+ 8.5
850
+ =======
851
+ 9
852
+ >>>>>>> rename^0:renamed_file
853
+ EOF
854
test_cmp expected renamed_file
855
'
856
t/t6023-merge-file.sh
+298
-270
@@ -3,56 +3,59 @@
3
test_description='RCS merge replacement: merge-file'
4
. ./test-lib.sh
5
6
-cat > orig.txt << EOF
7
-Dominus regit me,
8
-et nihil mihi deerit.
9
-In loco pascuae ibi me collocavit,
10
-super aquam refectionis educavit me;
11
-animam meam convertit,
12
-deduxit me super semitas jusitiae,
13
-propter nomen suum.
14
-EOF
15
-
16
-cat > new1.txt << EOF
17
-Dominus regit me,
18
-et nihil mihi deerit.
19
-In loco pascuae ibi me collocavit,
20
-super aquam refectionis educavit me;
21
-animam meam convertit,
22
-deduxit me super semitas jusitiae,
23
-propter nomen suum.
24
-Nam et si ambulavero in medio umbrae mortis,
25
-non timebo mala, quoniam tu mecum es:
26
-virga tua et baculus tuus ipsa me consolata sunt.
27
-EOF
28
-
29
-cat > new2.txt << EOF
30
-Dominus regit me, et nihil mihi deerit.
31
-In loco pascuae ibi me collocavit,
32
-super aquam refectionis educavit me;
33
-animam meam convertit,
34
-deduxit me super semitas jusitiae,
35
-propter nomen suum.
36
-EOF
37
-
38
-cat > new3.txt << EOF
39
-DOMINUS regit me,
40
-et nihil mihi deerit.
41
-In loco pascuae ibi me collocavit,
42
-super aquam refectionis educavit me;
43
-animam meam convertit,
44
-deduxit me super semitas jusitiae,
45
-propter nomen suum.
46
-EOF
47
-
48
-cat > new4.txt << EOF
49
-Dominus regit me, et nihil mihi deerit.
50
-In loco pascuae ibi me collocavit,
51
-super aquam refectionis educavit me;
52
-animam meam convertit,
53
-deduxit me super semitas jusitiae,
54
-EOF
55
-printf "propter nomen suum." >> new4.txt
6
+test_expect_success 'setup' '
7
+ cat >orig.txt <<-\EOF &&
8
+ Dominus regit me,
9
+ et nihil mihi deerit.
10
+ In loco pascuae ibi me collocavit,
11
+ super aquam refectionis educavit me;
12
+ animam meam convertit,
13
+ deduxit me super semitas jusitiae,
14
+ propter nomen suum.
15
+ EOF
16
+
17
+ cat >new1.txt <<-\EOF &&
18
+ Dominus regit me,
19
+ et nihil mihi deerit.
20
+ In loco pascuae ibi me collocavit,
21
+ super aquam refectionis educavit me;
22
+ animam meam convertit,
23
+ deduxit me super semitas jusitiae,
24
+ propter nomen suum.
25
+ Nam et si ambulavero in medio umbrae mortis,
26
+ non timebo mala, quoniam tu mecum es:
27
+ virga tua et baculus tuus ipsa me consolata sunt.
28
+ EOF
29
+
30
+ cat >new2.txt <<-\EOF &&
31
+ Dominus regit me, et nihil mihi deerit.
32
+ In loco pascuae ibi me collocavit,
33
+ super aquam refectionis educavit me;
34
+ animam meam convertit,
35
+ deduxit me super semitas jusitiae,
36
+ propter nomen suum.
37
+ EOF
38
+
39
+ cat >new3.txt <<-\EOF &&
40
+ DOMINUS regit me,
41
+ et nihil mihi deerit.
42
+ In loco pascuae ibi me collocavit,
43
+ super aquam refectionis educavit me;
44
+ animam meam convertit,
45
+ deduxit me super semitas jusitiae,
46
+ propter nomen suum.
47
+ EOF
48
+
49
+ cat >new4.txt <<-\EOF &&
50
+ Dominus regit me, et nihil mihi deerit.
51
+ In loco pascuae ibi me collocavit,
52
+ super aquam refectionis educavit me;
53
+ animam meam convertit,
54
+ deduxit me super semitas jusitiae,
55
+ EOF
56
+
57
+ printf "propter nomen suum." >>new4.txt
58
+'
59
60
test_expect_success 'merge with no changes' '
61
cp orig.txt test.txt &&
@@ -60,9 +63,10 @@ test_expect_success 'merge with no changes' '
63
test_cmp test.txt orig.txt
64
'
65
63
-cp new1.txt test.txt
64
-test_expect_success "merge without conflict" \
65
- "git merge-file test.txt orig.txt new2.txt"
66
+test_expect_success "merge without conflict" '
67
+ cp new1.txt test.txt &&
68
+ git merge-file test.txt orig.txt new2.txt
69
+'
70
71
test_expect_success 'works in subdirectory' '
72
mkdir dir &&
@@ -73,151 +77,176 @@ test_expect_success 'works in subdirectory' '
77
test_path_is_missing a.txt
78
'
79
76
-cp new1.txt test.txt
77
-test_expect_success "merge without conflict (--quiet)" \
78
- "git merge-file --quiet test.txt orig.txt new2.txt"
79
-
80
-cp new1.txt test2.txt
81
-test_expect_failure "merge without conflict (missing LF at EOF)" \
82
- "git merge-file test2.txt orig.txt new4.txt"
83
-
84
-test_expect_failure "merge result added missing LF" \
85
- "test_cmp test.txt test2.txt"
86
-
87
-cp new4.txt test3.txt
88
-test_expect_success "merge without conflict (missing LF at EOF, away from change in the other file)" \
89
- "git merge-file --quiet test3.txt new2.txt new3.txt"
90
-
91
-cat > expect.txt << EOF
92
-DOMINUS regit me,
93
-et nihil mihi deerit.
94
-In loco pascuae ibi me collocavit,
95
-super aquam refectionis educavit me;
96
-animam meam convertit,
97
-deduxit me super semitas jusitiae,
98
-EOF
99
-printf "propter nomen suum." >> expect.txt
100
-
101
-test_expect_success "merge does not add LF away of change" \
102
- "test_cmp expect.txt test3.txt"
103
-
104
-cp test.txt backup.txt
105
-test_expect_success "merge with conflicts" \
106
- "test_must_fail git merge-file test.txt orig.txt new3.txt"
107
-
108
-cat > expect.txt << EOF
109
-<<<<<<< test.txt
110
-Dominus regit me, et nihil mihi deerit.
111
-=======
112
-DOMINUS regit me,
113
-et nihil mihi deerit.
114
->>>>>>> new3.txt
115
-In loco pascuae ibi me collocavit,
116
-super aquam refectionis educavit me;
117
-animam meam convertit,
118
-deduxit me super semitas jusitiae,
119
-propter nomen suum.
120
-Nam et si ambulavero in medio umbrae mortis,
121
-non timebo mala, quoniam tu mecum es:
122
-virga tua et baculus tuus ipsa me consolata sunt.
123
-EOF
124
-
125
-test_expect_success "expected conflict markers" "test_cmp expect.txt test.txt"
126
-
127
-cp backup.txt test.txt
128
-
129
-cat > expect.txt << EOF
130
-Dominus regit me, et nihil mihi deerit.
131
-In loco pascuae ibi me collocavit,
132
-super aquam refectionis educavit me;
133
-animam meam convertit,
134
-deduxit me super semitas jusitiae,
135
-propter nomen suum.
136
-Nam et si ambulavero in medio umbrae mortis,
137
-non timebo mala, quoniam tu mecum es:
138
-virga tua et baculus tuus ipsa me consolata sunt.
139
-EOF
140
-test_expect_success "merge conflicting with --ours" \
141
- "git merge-file --ours test.txt orig.txt new3.txt && test_cmp expect.txt test.txt"
142
-cp backup.txt test.txt
143
-
144
-cat > expect.txt << EOF
145
-DOMINUS regit me,
146
-et nihil mihi deerit.
147
-In loco pascuae ibi me collocavit,
148
-super aquam refectionis educavit me;
149
-animam meam convertit,
150
-deduxit me super semitas jusitiae,
151
-propter nomen suum.
152
-Nam et si ambulavero in medio umbrae mortis,
153
-non timebo mala, quoniam tu mecum es:
154
-virga tua et baculus tuus ipsa me consolata sunt.
155
-EOF
156
-test_expect_success "merge conflicting with --theirs" \
157
- "git merge-file --theirs test.txt orig.txt new3.txt && test_cmp expect.txt test.txt"
158
-cp backup.txt test.txt
159
-
160
-cat > expect.txt << EOF
161
-Dominus regit me, et nihil mihi deerit.
162
-DOMINUS regit me,
163
-et nihil mihi deerit.
164
-In loco pascuae ibi me collocavit,
165
-super aquam refectionis educavit me;
166
-animam meam convertit,
167
-deduxit me super semitas jusitiae,
168
-propter nomen suum.
169
-Nam et si ambulavero in medio umbrae mortis,
170
-non timebo mala, quoniam tu mecum es:
171
-virga tua et baculus tuus ipsa me consolata sunt.
172
-EOF
173
-test_expect_success "merge conflicting with --union" \
174
- "git merge-file --union test.txt orig.txt new3.txt && test_cmp expect.txt test.txt"
175
-cp backup.txt test.txt
176
-
177
-test_expect_success "merge with conflicts, using -L" \
178
- "test_must_fail git merge-file -L 1 -L 2 test.txt orig.txt new3.txt"
179
-
180
-cat > expect.txt << EOF
181
-<<<<<<< 1
182
-Dominus regit me, et nihil mihi deerit.
183
-=======
184
-DOMINUS regit me,
185
-et nihil mihi deerit.
186
->>>>>>> new3.txt
187
-In loco pascuae ibi me collocavit,
188
-super aquam refectionis educavit me;
189
-animam meam convertit,
190
-deduxit me super semitas jusitiae,
191
-propter nomen suum.
192
-Nam et si ambulavero in medio umbrae mortis,
193
-non timebo mala, quoniam tu mecum es:
194
-virga tua et baculus tuus ipsa me consolata sunt.
195
-EOF
196
-
197
-test_expect_success "expected conflict markers, with -L" \
198
- "test_cmp expect.txt test.txt"
199
-
200
-sed "s/ tu / TU /" < new1.txt > new5.txt
201
-test_expect_success "conflict in removed tail" \
202
- "test_must_fail git merge-file -p orig.txt new1.txt new5.txt > out"
203
-
204
-cat > expect << EOF
205
-Dominus regit me,
206
-et nihil mihi deerit.
207
-In loco pascuae ibi me collocavit,
208
-super aquam refectionis educavit me;
209
-animam meam convertit,
210
-deduxit me super semitas jusitiae,
211
-propter nomen suum.
212
-<<<<<<< orig.txt
213
-=======
214
-Nam et si ambulavero in medio umbrae mortis,
215
-non timebo mala, quoniam TU mecum es:
216
-virga tua et baculus tuus ipsa me consolata sunt.
217
->>>>>>> new5.txt
218
-EOF
219
-
220
-test_expect_success "expected conflict markers" "test_cmp expect out"
80
+test_expect_success "merge without conflict (--quiet)" '
81
+ cp new1.txt test.txt &&
82
+ git merge-file --quiet test.txt orig.txt new2.txt
83
+'
84
+
85
+test_expect_failure "merge without conflict (missing LF at EOF)" '
86
+ cp new1.txt test2.txt &&
87
+ git merge-file test2.txt orig.txt new4.txt
88
+'
89
+
90
+test_expect_failure "merge result added missing LF" '
91
+ test_cmp test.txt test2.txt
92
+'
93
+
94
+test_expect_success "merge without conflict (missing LF at EOF, away from change in the other file)" '
95
+ cp new4.txt test3.txt &&
96
+ git merge-file --quiet test3.txt new2.txt new3.txt
97
+'
98
+
99
+test_expect_success "merge does not add LF away of change" '
100
+ cat >expect.txt <<-\EOF &&
101
+ DOMINUS regit me,
102
+ et nihil mihi deerit.
103
+ In loco pascuae ibi me collocavit,
104
+ super aquam refectionis educavit me;
105
+ animam meam convertit,
106
+ deduxit me super semitas jusitiae,
107
+ EOF
108
+ printf "propter nomen suum." >>expect.txt &&
109
+
110
+ test_cmp expect.txt test3.txt
111
+'
112
+
113
+test_expect_success "merge with conflicts" '
114
+ cp test.txt backup.txt &&
115
+ test_must_fail git merge-file test.txt orig.txt new3.txt
116
+'
117
+
118
+test_expect_success "expected conflict markers" '
119
+ cat >expect.txt <<-\EOF &&
120
+ <<<<<<< test.txt
121
+ Dominus regit me, et nihil mihi deerit.
122
+ =======
123
+ DOMINUS regit me,
124
+ et nihil mihi deerit.
125
+ >>>>>>> new3.txt
126
+ In loco pascuae ibi me collocavit,
127
+ super aquam refectionis educavit me;
128
+ animam meam convertit,
129
+ deduxit me super semitas jusitiae,
130
+ propter nomen suum.
131
+ Nam et si ambulavero in medio umbrae mortis,
132
+ non timebo mala, quoniam tu mecum es:
133
+ virga tua et baculus tuus ipsa me consolata sunt.
134
+ EOF
135
+
136
+ test_cmp expect.txt test.txt
137
+'
138
+
139
+test_expect_success "merge conflicting with --ours" '
140
+ cp backup.txt test.txt &&
141
+
142
+ cat >expect.txt <<-\EOF &&
143
+ Dominus regit me, et nihil mihi deerit.
144
+ In loco pascuae ibi me collocavit,
145
+ super aquam refectionis educavit me;
146
+ animam meam convertit,
147
+ deduxit me super semitas jusitiae,
148
+ propter nomen suum.
149
+ Nam et si ambulavero in medio umbrae mortis,
150
+ non timebo mala, quoniam tu mecum es:
151
+ virga tua et baculus tuus ipsa me consolata sunt.
152
+ EOF
153
+
154
+ git merge-file --ours test.txt orig.txt new3.txt &&
155
+ test_cmp expect.txt test.txt
156
+'
157
+
158
+test_expect_success "merge conflicting with --theirs" '
159
+ cp backup.txt test.txt &&
160
+
161
+ cat >expect.txt <<-\EOF &&
162
+ DOMINUS regit me,
163
+ et nihil mihi deerit.
164
+ In loco pascuae ibi me collocavit,
165
+ super aquam refectionis educavit me;
166
+ animam meam convertit,
167
+ deduxit me super semitas jusitiae,
168
+ propter nomen suum.
169
+ Nam et si ambulavero in medio umbrae mortis,
170
+ non timebo mala, quoniam tu mecum es:
171
+ virga tua et baculus tuus ipsa me consolata sunt.
172
+ EOF
173
+
174
+ git merge-file --theirs test.txt orig.txt new3.txt &&
175
+ test_cmp expect.txt test.txt
176
+'
177
+
178
+test_expect_success "merge conflicting with --union" '
179
+ cp backup.txt test.txt &&
180
+
181
+ cat >expect.txt <<-\EOF &&
182
+ Dominus regit me, et nihil mihi deerit.
183
+ DOMINUS regit me,
184
+ et nihil mihi deerit.
185
+ In loco pascuae ibi me collocavit,
186
+ super aquam refectionis educavit me;
187
+ animam meam convertit,
188
+ deduxit me super semitas jusitiae,
189
+ propter nomen suum.
190
+ Nam et si ambulavero in medio umbrae mortis,
191
+ non timebo mala, quoniam tu mecum es:
192
+ virga tua et baculus tuus ipsa me consolata sunt.
193
+ EOF
194
+
195
+ git merge-file --union test.txt orig.txt new3.txt &&
196
+ test_cmp expect.txt test.txt
197
+'
198
+
199
+test_expect_success "merge with conflicts, using -L" '
200
+ cp backup.txt test.txt &&
201
+
202
+ test_must_fail git merge-file -L 1 -L 2 test.txt orig.txt new3.txt
203
+'
204
+
205
+test_expect_success "expected conflict markers, with -L" '
206
+ cat >expect.txt <<-\EOF &&
207
+ <<<<<<< 1
208
+ Dominus regit me, et nihil mihi deerit.
209
+ =======
210
+ DOMINUS regit me,
211
+ et nihil mihi deerit.
212
+ >>>>>>> new3.txt
213
+ In loco pascuae ibi me collocavit,
214
+ super aquam refectionis educavit me;
215
+ animam meam convertit,
216
+ deduxit me super semitas jusitiae,
217
+ propter nomen suum.
218
+ Nam et si ambulavero in medio umbrae mortis,
219
+ non timebo mala, quoniam tu mecum es:
220
+ virga tua et baculus tuus ipsa me consolata sunt.
221
+ EOF
222
+
223
+ test_cmp expect.txt test.txt
224
+'
225
+
226
+test_expect_success "conflict in removed tail" '
227
+ sed "s/ tu / TU /" <new1.txt >new5.txt &&
228
+ test_must_fail git merge-file -p orig.txt new1.txt new5.txt >out
229
+'
230
+
231
+test_expect_success "expected conflict markers" '
232
+ cat >expect <<-\EOF &&
233
+ Dominus regit me,
234
+ et nihil mihi deerit.
235
+ In loco pascuae ibi me collocavit,
236
+ super aquam refectionis educavit me;
237
+ animam meam convertit,
238
+ deduxit me super semitas jusitiae,
239
+ propter nomen suum.
240
+ <<<<<<< orig.txt
241
+ =======
242
+ Nam et si ambulavero in medio umbrae mortis,
243
+ non timebo mala, quoniam TU mecum es:
244
+ virga tua et baculus tuus ipsa me consolata sunt.
245
+ >>>>>>> new5.txt
246
+ EOF
247
+
248
+ test_cmp expect out
249
+'
250
251
test_expect_success 'binary files cannot be merged' '
252
test_must_fail git merge-file -p \
@@ -225,59 +254,55 @@ test_expect_success 'binary files cannot be merged' '
254
grep "Cannot merge binary files" merge.err
255
'
256
228
-sed -e "s/deerit.\$/deerit;/" -e "s/me;\$/me./" < new5.txt > new6.txt
229
-sed -e "s/deerit.\$/deerit,/" -e "s/me;\$/me,/" < new5.txt > new7.txt
230
-
257
test_expect_success 'MERGE_ZEALOUS simplifies non-conflicts' '
258
+ sed -e "s/deerit.\$/deerit;/" -e "s/me;\$/me./" <new5.txt >new6.txt &&
259
+ sed -e "s/deerit.\$/deerit,/" -e "s/me;\$/me,/" <new5.txt >new7.txt &&
260
261
test_must_fail git merge-file -p new6.txt new5.txt new7.txt > output &&
234
- test 1 = $(grep ======= < output | wc -l)
235
-
262
+ test 1 = $(grep ======= <output | wc -l)
263
'
264
238
-sed -e 's/deerit./&%%%%/' -e "s/locavit,/locavit;/"< new6.txt | tr '%' '\012' > new8.txt
239
-sed -e 's/deerit./&%%%%/' -e "s/locavit,/locavit --/" < new7.txt | tr '%' '\012' > new9.txt
240
-
265
test_expect_success 'ZEALOUS_ALNUM' '
266
+ sed -e "s/deerit./&%%%%/" -e "s/locavit,/locavit;/" <new6.txt | tr % "\012" >new8.txt &&
267
+ sed -e "s/deerit./&%%%%/" -e "s/locavit,/locavit --/" <new7.txt | tr % "\012" >new9.txt &&
268
269
test_must_fail git merge-file -p \
244
- new8.txt new5.txt new9.txt > merge.out &&
245
- test 1 = $(grep ======= < merge.out | wc -l)
246
-
270
+ new8.txt new5.txt new9.txt >merge.out &&
271
+ test 1 = $(grep ======= <merge.out | wc -l)
272
'
273
249
-cat >expect <<\EOF
250
-Dominus regit me,
251
-<<<<<<< new8.txt
252
-et nihil mihi deerit;
274
+test_expect_success '"diff3 -m" style output (1)' '
275
+ cat >expect <<-\EOF &&
276
+ Dominus regit me,
277
+ <<<<<<< new8.txt
278
+ et nihil mihi deerit;
279
280
281
282
257
-In loco pascuae ibi me collocavit;
258
-super aquam refectionis educavit me.
259
-||||||| new5.txt
260
-et nihil mihi deerit.
261
-In loco pascuae ibi me collocavit,
262
-super aquam refectionis educavit me;
263
-=======
264
-et nihil mihi deerit,
283
+ In loco pascuae ibi me collocavit;
284
+ super aquam refectionis educavit me.
285
+ ||||||| new5.txt
286
+ et nihil mihi deerit.
287
+ In loco pascuae ibi me collocavit,
288
+ super aquam refectionis educavit me;
289
+ =======
290
+ et nihil mihi deerit,
291
292
293
294
269
-In loco pascuae ibi me collocavit --
270
-super aquam refectionis educavit me,
271
->>>>>>> new9.txt
272
-animam meam convertit,
273
-deduxit me super semitas jusitiae,
274
-propter nomen suum.
275
-Nam et si ambulavero in medio umbrae mortis,
276
-non timebo mala, quoniam TU mecum es:
277
-virga tua et baculus tuus ipsa me consolata sunt.
278
-EOF
295
+ In loco pascuae ibi me collocavit --
296
+ super aquam refectionis educavit me,
297
+ >>>>>>> new9.txt
298
+ animam meam convertit,
299
+ deduxit me super semitas jusitiae,
300
+ propter nomen suum.
301
+ Nam et si ambulavero in medio umbrae mortis,
302
+ non timebo mala, quoniam TU mecum es:
303
+ virga tua et baculus tuus ipsa me consolata sunt.
304
+ EOF
305
280
-test_expect_success '"diff3 -m" style output (1)' '
306
test_must_fail git merge-file -p --diff3 \
307
new8.txt new5.txt new9.txt >actual &&
308
test_cmp expect actual
@@ -290,61 +315,64 @@ test_expect_success '"diff3 -m" style output (2)' '
315
test_cmp expect actual
316
'
317
293
-cat >expect <<\EOF
294
-Dominus regit me,
295
-<<<<<<<<<< new8.txt
296
-et nihil mihi deerit;
318
+test_expect_success 'marker size' '
319
+ cat >expect <<-\EOF &&
320
+ Dominus regit me,
321
+ <<<<<<<<<< new8.txt
322
+ et nihil mihi deerit;
323
324
325
326
301
-In loco pascuae ibi me collocavit;
302
-super aquam refectionis educavit me.
303
-|||||||||| new5.txt
304
-et nihil mihi deerit.
305
-In loco pascuae ibi me collocavit,
306
-super aquam refectionis educavit me;
307
-==========
308
-et nihil mihi deerit,
327
+ In loco pascuae ibi me collocavit;
328
+ super aquam refectionis educavit me.
329
+ |||||||||| new5.txt
330
+ et nihil mihi deerit.
331
+ In loco pascuae ibi me collocavit,
332
+ super aquam refectionis educavit me;
333
+ ==========
334
+ et nihil mihi deerit,
335
336
337
338
313
-In loco pascuae ibi me collocavit --
314
-super aquam refectionis educavit me,
315
->>>>>>>>>> new9.txt
316
-animam meam convertit,
317
-deduxit me super semitas jusitiae,
318
-propter nomen suum.
319
-Nam et si ambulavero in medio umbrae mortis,
320
-non timebo mala, quoniam TU mecum es:
321
-virga tua et baculus tuus ipsa me consolata sunt.
322
-EOF
339
+ In loco pascuae ibi me collocavit --
340
+ super aquam refectionis educavit me,
341
+ >>>>>>>>>> new9.txt
342
+ animam meam convertit,
343
+ deduxit me super semitas jusitiae,
344
+ propter nomen suum.
345
+ Nam et si ambulavero in medio umbrae mortis,
346
+ non timebo mala, quoniam TU mecum es:
347
+ virga tua et baculus tuus ipsa me consolata sunt.
348
+ EOF
349
324
-test_expect_success 'marker size' '
350
test_must_fail git merge-file -p --marker-size=10 \
351
new8.txt new5.txt new9.txt >actual &&
352
test_cmp expect actual
353
'
354
330
-printf "line1\nline2\nline3" >nolf-orig.txt
331
-printf "line1\nline2\nline3x" >nolf-diff1.txt
332
-printf "line1\nline2\nline3y" >nolf-diff2.txt
355
+test_expect_success 'conflict at EOF without LF resolved by --ours' '
356
+ printf "line1\nline2\nline3" >nolf-orig.txt &&
357
+ printf "line1\nline2\nline3x" >nolf-diff1.txt &&
358
+ printf "line1\nline2\nline3y" >nolf-diff2.txt &&
359
334
-test_expect_success 'conflict at EOF without LF resolved by --ours' \
335
- 'git merge-file -p --ours nolf-diff1.txt nolf-orig.txt nolf-diff2.txt >output.txt &&
336
- printf "line1\nline2\nline3x" >expect.txt &&
337
- test_cmp expect.txt output.txt'
360
+ git merge-file -p --ours nolf-diff1.txt nolf-orig.txt nolf-diff2.txt >output.txt &&
361
+ printf "line1\nline2\nline3x" >expect.txt &&
362
+ test_cmp expect.txt output.txt
363
+'
364
339
-test_expect_success 'conflict at EOF without LF resolved by --theirs' \
340
- 'git merge-file -p --theirs nolf-diff1.txt nolf-orig.txt nolf-diff2.txt >output.txt &&
341
- printf "line1\nline2\nline3y" >expect.txt &&
342
- test_cmp expect.txt output.txt'
365
+test_expect_success 'conflict at EOF without LF resolved by --theirs' '
366
+ git merge-file -p --theirs nolf-diff1.txt nolf-orig.txt nolf-diff2.txt >output.txt &&
367
+ printf "line1\nline2\nline3y" >expect.txt &&
368
+ test_cmp expect.txt output.txt
369
+'
370
344
-test_expect_success 'conflict at EOF without LF resolved by --union' \
345
- 'git merge-file -p --union nolf-diff1.txt nolf-orig.txt nolf-diff2.txt >output.txt &&
346
- printf "line1\nline2\nline3x\nline3y" >expect.txt &&
347
- test_cmp expect.txt output.txt'
371
+test_expect_success 'conflict at EOF without LF resolved by --union' '
372
+ git merge-file -p --union nolf-diff1.txt nolf-orig.txt nolf-diff2.txt >output.txt &&
373
+ printf "line1\nline2\nline3x\nline3y" >expect.txt &&
374
+ test_cmp expect.txt output.txt
375
+'
376
377
test_expect_success 'conflict sections match existing line endings' '
378
printf "1\\r\\n2\\r\\n3" >crlf-orig.txt &&
t/t6026-merge-attr.sh
+23
-23
@@ -32,7 +32,29 @@ test_expect_success setup '
32
test_tick &&
33
git commit -m Side &&
34
35
- git tag anchor
35
+ git tag anchor &&
36
+
37
+ cat >./custom-merge <<-\EOF &&
38
+ #!/bin/sh
39
+
40
+ orig="$1" ours="$2" theirs="$3" exit="$4" path=$5
41
+ (
42
+ echo "orig is $orig"
43
+ echo "ours is $ours"
44
+ echo "theirs is $theirs"
45
+ echo "path is $path"
46
+ echo "=== orig ==="
47
+ cat "$orig"
48
+ echo "=== ours ==="
49
+ cat "$ours"
50
+ echo "=== theirs ==="
51
+ cat "$theirs"
52
+ ) >"$ours+"
53
+ cat "$ours+" >"$ours"
54
+ rm -f "$ours+"
55
+ exit "$exit"
56
+ EOF
57
+ chmod +x ./custom-merge
58
'
59
60
test_expect_success merge '
@@ -82,28 +104,6 @@ test_expect_success 'retry the merge with longer context' '
104
grep "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" actual
105
'
106
85
-cat >./custom-merge <<\EOF
86
-#!/bin/sh
87
-
88
-orig="$1" ours="$2" theirs="$3" exit="$4" path=$5
89
-(
90
- echo "orig is $orig"
91
- echo "ours is $ours"
92
- echo "theirs is $theirs"
93
- echo "path is $path"
94
- echo "=== orig ==="
95
- cat "$orig"
96
- echo "=== ours ==="
97
- cat "$ours"
98
- echo "=== theirs ==="
99
- cat "$theirs"
100
-) >"$ours+"
101
-cat "$ours+" >"$ours"
102
-rm -f "$ours+"
103
-exit "$exit"
104
-EOF
105
-chmod +x ./custom-merge
106
-
107
test_expect_success 'custom merge backend' '
108
109
echo "* merge=union" >.gitattributes &&
t/t6034-merge-rename-nocruft.sh
+60
-62
@@ -3,74 +3,73 @@
3
test_description='Merge-recursive merging renames'
4
. ./test-lib.sh
5
6
-test_expect_success setup \
7
-'
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
6
+test_expect_success 'setup' '
7
+ cat >A <<-\EOF &&
8
+ a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
9
+ b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
10
+ c cccccccccccccccccccccccccccccccccccccccccccccccc
11
+ d dddddddddddddddddddddddddddddddddddddddddddddddd
12
+ e eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
13
+ f ffffffffffffffffffffffffffffffffffffffffffffffff
14
+ g gggggggggggggggggggggggggggggggggggggggggggggggg
15
+ h hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
16
+ i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
17
+ j jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
18
+ k kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
19
+ l llllllllllllllllllllllllllllllllllllllllllllllll
20
+ m mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
21
+ n nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
22
+ o oooooooooooooooooooooooooooooooooooooooooooooooo
23
+ EOF
24
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
25
+ cat >M <<-\EOF &&
26
+ A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
27
+ B BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
28
+ C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
29
+ D DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
30
+ E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
31
+ F FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
32
+ G GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
33
+ H HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
34
+ I IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
35
+ J JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
36
+ K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
37
+ L LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
38
+ M MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
39
+ N NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
40
+ O OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
41
+ EOF
42
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 &&
43
+ git add A M &&
44
+ git commit -m "initial has A and M" &&
45
+ git branch white &&
46
+ git branch red &&
47
+ git branch blue &&
48
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" &&
49
+ git checkout white &&
50
+ sed -e "/^g /s/.*/g : white changes a line/" <A >B &&
51
+ sed -e "/^G /s/.*/G : colored branch changes a line/" <M >N &&
52
+ rm -f A M &&
53
+ git update-index --add --remove A B M N &&
54
+ git commit -m "white renames A->B, M->N" &&
55
57
-git checkout red &&
58
-echo created by red >R &&
59
-git update-index --add R &&
60
-git commit -m "red creates R" &&
56
+ git checkout red &&
57
+ echo created by red >R &&
58
+ git update-index --add R &&
59
+ git commit -m "red creates R" &&
60
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" &&
61
+ git checkout blue &&
62
+ sed -e "/^o /s/.*/g : blue changes a line/" <A >B &&
63
+ rm -f A &&
64
+ mv B A &&
65
+ git update-index A &&
66
+ git commit -m "blue modify A" &&
67
69
-git checkout master'
68
+ git checkout master
69
+'
70
71
# This test broke in 65ac6e9c3f47807cb603af07a6a9e1a43bc119ae
72
-test_expect_success 'merge white into red (A->B,M->N)' \
73
-'
72
+test_expect_success 'merge white into red (A->B,M->N)' '
73
git checkout -b red-white red &&
74
git merge white &&
75
git write-tree &&
@@ -82,8 +81,7 @@ test_expect_success 'merge white into red (A->B,M->N)' \
81
'
82
83
# This test broke in 8371234ecaaf6e14fe3f2082a855eff1bbd79ae9
85
-test_expect_success 'merge blue into white (A->B, mod A, A untracked)' \
86
-'
84
+test_expect_success 'merge blue into white (A->B, mod A, A untracked)' '
85
git checkout -b white-blue white &&
86
echo dirty >A &&
87
git merge blue &&