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>maint
parent
d0654dc308
commit
42d180dd01
|
@ -10,72 +10,41 @@
|
|||
test_description='Test criss-cross merge'
|
||||
. ./test-lib.sh
|
||||
|
||||
test_expect_success 'prepare repository' \
|
||||
'echo "1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9" > file &&
|
||||
test_expect_success 'prepare repository' '
|
||||
test_write_lines 1 2 3 4 5 6 7 8 9 >file &&
|
||||
git add file &&
|
||||
git commit -m "Initial commit" file &&
|
||||
|
||||
git branch A &&
|
||||
git branch B &&
|
||||
git checkout A &&
|
||||
echo "1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8 changed in B8, branch A
|
||||
9" > file &&
|
||||
|
||||
test_write_lines 1 2 3 4 5 6 7 "8 changed in B8, branch A" 9 >file &&
|
||||
git commit -m "B8" file &&
|
||||
git checkout B &&
|
||||
echo "1
|
||||
2
|
||||
3 changed in C3, branch B
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
" > file &&
|
||||
|
||||
test_write_lines 1 2 "3 changed in C3, branch B" 4 5 6 7 8 9 >file &&
|
||||
git commit -m "C3" file &&
|
||||
git branch C3 &&
|
||||
|
||||
git merge -m "pre E3 merge" A &&
|
||||
echo "1
|
||||
2
|
||||
3 changed in E3, branch B. New file size
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8 changed in B8, branch A
|
||||
9
|
||||
" > file &&
|
||||
|
||||
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 &&
|
||||
git commit -m "E3" file &&
|
||||
|
||||
git checkout A &&
|
||||
git merge -m "pre D8 merge" C3 &&
|
||||
echo "1
|
||||
2
|
||||
3 changed in C3, branch B
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8 changed in D8, branch A. New file size 2
|
||||
9" > file &&
|
||||
git commit -m D8 file'
|
||||
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 &&
|
||||
|
||||
test_expect_success 'Criss-cross merge' 'git merge -m "final merge" B'
|
||||
git commit -m D8 file
|
||||
'
|
||||
|
||||
cat > file-expect <<EOF
|
||||
test_expect_success 'Criss-cross merge' '
|
||||
git merge -m "final merge" B
|
||||
'
|
||||
|
||||
test_expect_success 'Criss-cross merge result' '
|
||||
cat <<-\EOF >file-expect &&
|
||||
1
|
||||
2
|
||||
3 changed in E3, branch B. New file size
|
||||
|
@ -87,10 +56,12 @@ cat > file-expect <<EOF
|
|||
9
|
||||
EOF
|
||||
|
||||
test_expect_success 'Criss-cross merge result' 'cmp file file-expect'
|
||||
test_cmp file-expect file
|
||||
'
|
||||
|
||||
test_expect_success 'Criss-cross merge fails (-s resolve)' \
|
||||
'git reset --hard A^ &&
|
||||
test_must_fail git merge -s resolve -m "final merge" B'
|
||||
test_expect_success 'Criss-cross merge fails (-s resolve)' '
|
||||
git reset --hard A^ &&
|
||||
test_must_fail git merge -s resolve -m "final merge" B
|
||||
'
|
||||
|
||||
test_done
|
||||
|
|
|
@ -8,9 +8,8 @@ modify () {
|
|||
mv "$2.x" "$2"
|
||||
}
|
||||
|
||||
test_expect_success setup \
|
||||
'
|
||||
cat >A <<\EOF &&
|
||||
test_expect_success 'setup' '
|
||||
cat >A <<-\EOF &&
|
||||
a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
c cccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
|
@ -28,7 +27,7 @@ n nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
|
|||
o oooooooooooooooooooooooooooooooooooooooooooooooo
|
||||
EOF
|
||||
|
||||
cat >M <<\EOF &&
|
||||
cat >M <<-\EOF &&
|
||||
A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
B BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
||||
C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
|
||||
|
@ -95,7 +94,8 @@ rm A &&
|
|||
git update-index --add B &&
|
||||
git commit -q -a -m "changed and renamed" &&
|
||||
|
||||
git checkout master'
|
||||
git checkout master
|
||||
'
|
||||
|
||||
test_expect_success 'pull renaming branch into unrenaming one' \
|
||||
'
|
||||
|
@ -288,14 +288,15 @@ test_expect_success 'setup for rename + d/f conflicts' '
|
|||
git commit -m "Conflicting change"
|
||||
'
|
||||
|
||||
printf "1\n2\n3\n4\n5555\n6\n7\n8\n9\n10\n11\n" >expected
|
||||
|
||||
test_expect_success 'Rename+D/F conflict; renamed file merges + dir not in way' '
|
||||
git reset --hard &&
|
||||
git checkout -q renamed-file-has-no-conflicts^0 &&
|
||||
|
||||
git merge --strategy=recursive dir-not-in-way &&
|
||||
|
||||
git diff --quiet &&
|
||||
test -f dir &&
|
||||
printf "1\n2\n3\n4\n5555\n6\n7\n8\n9\n10\n11\n" >expected &&
|
||||
test_cmp expected dir
|
||||
'
|
||||
|
||||
|
@ -342,7 +343,20 @@ test_expect_success 'Same as previous, but merged other way' '
|
|||
test_cmp expected dir~renamed-file-has-no-conflicts
|
||||
'
|
||||
|
||||
cat >expected <<\EOF &&
|
||||
test_expect_success 'Rename+D/F conflict; renamed file cannot merge, dir not in way' '
|
||||
git reset --hard &&
|
||||
rm -rf dir~* &&
|
||||
git checkout -q renamed-file-has-conflicts^0 &&
|
||||
test_must_fail git merge --strategy=recursive dir-not-in-way &&
|
||||
|
||||
test 3 -eq "$(git ls-files -u | wc -l)" &&
|
||||
test 3 -eq "$(git ls-files -u dir | wc -l)" &&
|
||||
|
||||
test_must_fail git diff --quiet &&
|
||||
test_must_fail git diff --cached --quiet &&
|
||||
|
||||
test -f dir &&
|
||||
cat >expected <<-\EOF &&
|
||||
1
|
||||
2
|
||||
3
|
||||
|
@ -359,20 +373,6 @@ cat >expected <<\EOF &&
|
|||
11
|
||||
>>>>>>> dir-not-in-way:sub/file
|
||||
EOF
|
||||
|
||||
test_expect_success 'Rename+D/F conflict; renamed file cannot merge, dir not in way' '
|
||||
git reset --hard &&
|
||||
rm -rf dir~* &&
|
||||
git checkout -q renamed-file-has-conflicts^0 &&
|
||||
test_must_fail git merge --strategy=recursive dir-not-in-way &&
|
||||
|
||||
test 3 -eq "$(git ls-files -u | wc -l)" &&
|
||||
test 3 -eq "$(git ls-files -u dir | wc -l)" &&
|
||||
|
||||
test_must_fail git diff --quiet &&
|
||||
test_must_fail git diff --cached --quiet &&
|
||||
|
||||
test -f dir &&
|
||||
test_cmp expected dir
|
||||
'
|
||||
|
||||
|
@ -396,7 +396,22 @@ test_expect_success 'Rename+D/F conflict; renamed file cannot merge and dir in t
|
|||
test_cmp expected dir~HEAD
|
||||
'
|
||||
|
||||
cat >expected <<\EOF &&
|
||||
test_expect_success 'Same as previous, but merged other way' '
|
||||
git reset --hard &&
|
||||
rm -rf dir~* &&
|
||||
git checkout -q dir-in-way^0 &&
|
||||
test_must_fail git merge --strategy=recursive renamed-file-has-conflicts &&
|
||||
|
||||
test 5 -eq "$(git ls-files -u | wc -l)" &&
|
||||
test 3 -eq "$(git ls-files -u dir | grep -v file-in-the-way | wc -l)" &&
|
||||
test 2 -eq "$(git ls-files -u dir/file-in-the-way | wc -l)" &&
|
||||
|
||||
test_must_fail git diff --quiet &&
|
||||
test_must_fail git diff --cached --quiet &&
|
||||
|
||||
test -f dir/file-in-the-way &&
|
||||
test -f dir~renamed-file-has-conflicts &&
|
||||
cat >expected <<-\EOF &&
|
||||
1
|
||||
2
|
||||
3
|
||||
|
@ -413,22 +428,6 @@ cat >expected <<\EOF &&
|
|||
12
|
||||
>>>>>>> renamed-file-has-conflicts:dir
|
||||
EOF
|
||||
|
||||
test_expect_success 'Same as previous, but merged other way' '
|
||||
git reset --hard &&
|
||||
rm -rf dir~* &&
|
||||
git checkout -q dir-in-way^0 &&
|
||||
test_must_fail git merge --strategy=recursive renamed-file-has-conflicts &&
|
||||
|
||||
test 5 -eq "$(git ls-files -u | wc -l)" &&
|
||||
test 3 -eq "$(git ls-files -u dir | grep -v file-in-the-way | wc -l)" &&
|
||||
test 2 -eq "$(git ls-files -u dir/file-in-the-way | wc -l)" &&
|
||||
|
||||
test_must_fail git diff --quiet &&
|
||||
test_must_fail git diff --cached --quiet &&
|
||||
|
||||
test -f dir/file-in-the-way &&
|
||||
test -f dir~renamed-file-has-conflicts &&
|
||||
test_cmp expected dir~renamed-file-has-conflicts
|
||||
'
|
||||
|
||||
|
@ -810,7 +809,11 @@ test_expect_success 'setup for use of extended merge markers' '
|
|||
git commit -mC
|
||||
'
|
||||
|
||||
cat >expected <<\EOF &&
|
||||
test_expect_success 'merge master into rename has correct extended markers' '
|
||||
git checkout rename^0 &&
|
||||
test_must_fail git merge -s recursive master^0 &&
|
||||
|
||||
cat >expected <<-\EOF &&
|
||||
1
|
||||
2
|
||||
3
|
||||
|
@ -825,14 +828,15 @@ cat >expected <<\EOF &&
|
|||
8.5
|
||||
>>>>>>> master^0:original_file
|
||||
EOF
|
||||
|
||||
test_expect_success 'merge master into rename has correct extended markers' '
|
||||
git checkout rename^0 &&
|
||||
test_must_fail git merge -s recursive master^0 &&
|
||||
test_cmp expected renamed_file
|
||||
'
|
||||
|
||||
cat >expected <<\EOF &&
|
||||
test_expect_success 'merge rename into master has correct extended markers' '
|
||||
git reset --hard &&
|
||||
git checkout master^0 &&
|
||||
test_must_fail git merge -s recursive rename^0 &&
|
||||
|
||||
cat >expected <<-\EOF &&
|
||||
1
|
||||
2
|
||||
3
|
||||
|
@ -847,11 +851,6 @@ cat >expected <<\EOF &&
|
|||
9
|
||||
>>>>>>> rename^0:renamed_file
|
||||
EOF
|
||||
|
||||
test_expect_success 'merge rename into master has correct extended markers' '
|
||||
git reset --hard &&
|
||||
git checkout master^0 &&
|
||||
test_must_fail git merge -s recursive rename^0 &&
|
||||
test_cmp expected renamed_file
|
||||
'
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
test_description='RCS merge replacement: merge-file'
|
||||
. ./test-lib.sh
|
||||
|
||||
cat > orig.txt << EOF
|
||||
test_expect_success 'setup' '
|
||||
cat >orig.txt <<-\EOF &&
|
||||
Dominus regit me,
|
||||
et nihil mihi deerit.
|
||||
In loco pascuae ibi me collocavit,
|
||||
|
@ -13,7 +14,7 @@ deduxit me super semitas jusitiae,
|
|||
propter nomen suum.
|
||||
EOF
|
||||
|
||||
cat > new1.txt << EOF
|
||||
cat >new1.txt <<-\EOF &&
|
||||
Dominus regit me,
|
||||
et nihil mihi deerit.
|
||||
In loco pascuae ibi me collocavit,
|
||||
|
@ -26,7 +27,7 @@ non timebo mala, quoniam tu mecum es:
|
|||
virga tua et baculus tuus ipsa me consolata sunt.
|
||||
EOF
|
||||
|
||||
cat > new2.txt << EOF
|
||||
cat >new2.txt <<-\EOF &&
|
||||
Dominus regit me, et nihil mihi deerit.
|
||||
In loco pascuae ibi me collocavit,
|
||||
super aquam refectionis educavit me;
|
||||
|
@ -35,7 +36,7 @@ deduxit me super semitas jusitiae,
|
|||
propter nomen suum.
|
||||
EOF
|
||||
|
||||
cat > new3.txt << EOF
|
||||
cat >new3.txt <<-\EOF &&
|
||||
DOMINUS regit me,
|
||||
et nihil mihi deerit.
|
||||
In loco pascuae ibi me collocavit,
|
||||
|
@ -45,14 +46,16 @@ deduxit me super semitas jusitiae,
|
|||
propter nomen suum.
|
||||
EOF
|
||||
|
||||
cat > new4.txt << EOF
|
||||
cat >new4.txt <<-\EOF &&
|
||||
Dominus regit me, et nihil mihi deerit.
|
||||
In loco pascuae ibi me collocavit,
|
||||
super aquam refectionis educavit me;
|
||||
animam meam convertit,
|
||||
deduxit me super semitas jusitiae,
|
||||
EOF
|
||||
|
||||
printf "propter nomen suum." >>new4.txt
|
||||
'
|
||||
|
||||
test_expect_success 'merge with no changes' '
|
||||
cp orig.txt test.txt &&
|
||||
|
@ -60,9 +63,10 @@ test_expect_success 'merge with no changes' '
|
|||
test_cmp test.txt orig.txt
|
||||
'
|
||||
|
||||
cp new1.txt test.txt
|
||||
test_expect_success "merge without conflict" \
|
||||
"git merge-file test.txt orig.txt new2.txt"
|
||||
test_expect_success "merge without conflict" '
|
||||
cp new1.txt test.txt &&
|
||||
git merge-file test.txt orig.txt new2.txt
|
||||
'
|
||||
|
||||
test_expect_success 'works in subdirectory' '
|
||||
mkdir dir &&
|
||||
|
@ -73,22 +77,27 @@ test_expect_success 'works in subdirectory' '
|
|||
test_path_is_missing a.txt
|
||||
'
|
||||
|
||||
cp new1.txt test.txt
|
||||
test_expect_success "merge without conflict (--quiet)" \
|
||||
"git merge-file --quiet test.txt orig.txt new2.txt"
|
||||
test_expect_success "merge without conflict (--quiet)" '
|
||||
cp new1.txt test.txt &&
|
||||
git merge-file --quiet test.txt orig.txt new2.txt
|
||||
'
|
||||
|
||||
cp new1.txt test2.txt
|
||||
test_expect_failure "merge without conflict (missing LF at EOF)" \
|
||||
"git merge-file test2.txt orig.txt new4.txt"
|
||||
test_expect_failure "merge without conflict (missing LF at EOF)" '
|
||||
cp new1.txt test2.txt &&
|
||||
git merge-file test2.txt orig.txt new4.txt
|
||||
'
|
||||
|
||||
test_expect_failure "merge result added missing LF" \
|
||||
"test_cmp test.txt test2.txt"
|
||||
test_expect_failure "merge result added missing LF" '
|
||||
test_cmp test.txt test2.txt
|
||||
'
|
||||
|
||||
cp new4.txt test3.txt
|
||||
test_expect_success "merge without conflict (missing LF at EOF, away from change in the other file)" \
|
||||
"git merge-file --quiet test3.txt new2.txt new3.txt"
|
||||
test_expect_success "merge without conflict (missing LF at EOF, away from change in the other file)" '
|
||||
cp new4.txt test3.txt &&
|
||||
git merge-file --quiet test3.txt new2.txt new3.txt
|
||||
'
|
||||
|
||||
cat > expect.txt << EOF
|
||||
test_expect_success "merge does not add LF away of change" '
|
||||
cat >expect.txt <<-\EOF &&
|
||||
DOMINUS regit me,
|
||||
et nihil mihi deerit.
|
||||
In loco pascuae ibi me collocavit,
|
||||
|
@ -96,16 +105,18 @@ super aquam refectionis educavit me;
|
|||
animam meam convertit,
|
||||
deduxit me super semitas jusitiae,
|
||||
EOF
|
||||
printf "propter nomen suum." >> expect.txt
|
||||
printf "propter nomen suum." >>expect.txt &&
|
||||
|
||||
test_expect_success "merge does not add LF away of change" \
|
||||
"test_cmp expect.txt test3.txt"
|
||||
test_cmp expect.txt test3.txt
|
||||
'
|
||||
|
||||
cp test.txt backup.txt
|
||||
test_expect_success "merge with conflicts" \
|
||||
"test_must_fail git merge-file test.txt orig.txt new3.txt"
|
||||
test_expect_success "merge with conflicts" '
|
||||
cp test.txt backup.txt &&
|
||||
test_must_fail git merge-file test.txt orig.txt new3.txt
|
||||
'
|
||||
|
||||
cat > expect.txt << EOF
|
||||
test_expect_success "expected conflict markers" '
|
||||
cat >expect.txt <<-\EOF &&
|
||||
<<<<<<< test.txt
|
||||
Dominus regit me, et nihil mihi deerit.
|
||||
=======
|
||||
|
@ -122,11 +133,13 @@ non timebo mala, quoniam tu mecum es:
|
|||
virga tua et baculus tuus ipsa me consolata sunt.
|
||||
EOF
|
||||
|
||||
test_expect_success "expected conflict markers" "test_cmp expect.txt test.txt"
|
||||
test_cmp expect.txt test.txt
|
||||
'
|
||||
|
||||
cp backup.txt test.txt
|
||||
test_expect_success "merge conflicting with --ours" '
|
||||
cp backup.txt test.txt &&
|
||||
|
||||
cat > expect.txt << EOF
|
||||
cat >expect.txt <<-\EOF &&
|
||||
Dominus regit me, et nihil mihi deerit.
|
||||
In loco pascuae ibi me collocavit,
|
||||
super aquam refectionis educavit me;
|
||||
|
@ -137,11 +150,15 @@ Nam et si ambulavero in medio umbrae mortis,
|
|||
non timebo mala, quoniam tu mecum es:
|
||||
virga tua et baculus tuus ipsa me consolata sunt.
|
||||
EOF
|
||||
test_expect_success "merge conflicting with --ours" \
|
||||
"git merge-file --ours test.txt orig.txt new3.txt && test_cmp expect.txt test.txt"
|
||||
cp backup.txt test.txt
|
||||
|
||||
cat > expect.txt << EOF
|
||||
git merge-file --ours test.txt orig.txt new3.txt &&
|
||||
test_cmp expect.txt test.txt
|
||||
'
|
||||
|
||||
test_expect_success "merge conflicting with --theirs" '
|
||||
cp backup.txt test.txt &&
|
||||
|
||||
cat >expect.txt <<-\EOF &&
|
||||
DOMINUS regit me,
|
||||
et nihil mihi deerit.
|
||||
In loco pascuae ibi me collocavit,
|
||||
|
@ -153,11 +170,15 @@ Nam et si ambulavero in medio umbrae mortis,
|
|||
non timebo mala, quoniam tu mecum es:
|
||||
virga tua et baculus tuus ipsa me consolata sunt.
|
||||
EOF
|
||||
test_expect_success "merge conflicting with --theirs" \
|
||||
"git merge-file --theirs test.txt orig.txt new3.txt && test_cmp expect.txt test.txt"
|
||||
cp backup.txt test.txt
|
||||
|
||||
cat > expect.txt << EOF
|
||||
git merge-file --theirs test.txt orig.txt new3.txt &&
|
||||
test_cmp expect.txt test.txt
|
||||
'
|
||||
|
||||
test_expect_success "merge conflicting with --union" '
|
||||
cp backup.txt test.txt &&
|
||||
|
||||
cat >expect.txt <<-\EOF &&
|
||||
Dominus regit me, et nihil mihi deerit.
|
||||
DOMINUS regit me,
|
||||
et nihil mihi deerit.
|
||||
|
@ -170,14 +191,19 @@ Nam et si ambulavero in medio umbrae mortis,
|
|||
non timebo mala, quoniam tu mecum es:
|
||||
virga tua et baculus tuus ipsa me consolata sunt.
|
||||
EOF
|
||||
test_expect_success "merge conflicting with --union" \
|
||||
"git merge-file --union test.txt orig.txt new3.txt && test_cmp expect.txt test.txt"
|
||||
cp backup.txt test.txt
|
||||
|
||||
test_expect_success "merge with conflicts, using -L" \
|
||||
"test_must_fail git merge-file -L 1 -L 2 test.txt orig.txt new3.txt"
|
||||
git merge-file --union test.txt orig.txt new3.txt &&
|
||||
test_cmp expect.txt test.txt
|
||||
'
|
||||
|
||||
cat > expect.txt << EOF
|
||||
test_expect_success "merge with conflicts, using -L" '
|
||||
cp backup.txt test.txt &&
|
||||
|
||||
test_must_fail git merge-file -L 1 -L 2 test.txt orig.txt new3.txt
|
||||
'
|
||||
|
||||
test_expect_success "expected conflict markers, with -L" '
|
||||
cat >expect.txt <<-\EOF &&
|
||||
<<<<<<< 1
|
||||
Dominus regit me, et nihil mihi deerit.
|
||||
=======
|
||||
|
@ -194,14 +220,16 @@ non timebo mala, quoniam tu mecum es:
|
|||
virga tua et baculus tuus ipsa me consolata sunt.
|
||||
EOF
|
||||
|
||||
test_expect_success "expected conflict markers, with -L" \
|
||||
"test_cmp expect.txt test.txt"
|
||||
test_cmp expect.txt test.txt
|
||||
'
|
||||
|
||||
sed "s/ tu / TU /" < new1.txt > new5.txt
|
||||
test_expect_success "conflict in removed tail" \
|
||||
"test_must_fail git merge-file -p orig.txt new1.txt new5.txt > out"
|
||||
test_expect_success "conflict in removed tail" '
|
||||
sed "s/ tu / TU /" <new1.txt >new5.txt &&
|
||||
test_must_fail git merge-file -p orig.txt new1.txt new5.txt >out
|
||||
'
|
||||
|
||||
cat > expect << EOF
|
||||
test_expect_success "expected conflict markers" '
|
||||
cat >expect <<-\EOF &&
|
||||
Dominus regit me,
|
||||
et nihil mihi deerit.
|
||||
In loco pascuae ibi me collocavit,
|
||||
|
@ -217,7 +245,8 @@ virga tua et baculus tuus ipsa me consolata sunt.
|
|||
>>>>>>> new5.txt
|
||||
EOF
|
||||
|
||||
test_expect_success "expected conflict markers" "test_cmp expect out"
|
||||
test_cmp expect out
|
||||
'
|
||||
|
||||
test_expect_success 'binary files cannot be merged' '
|
||||
test_must_fail git merge-file -p \
|
||||
|
@ -225,28 +254,25 @@ test_expect_success 'binary files cannot be merged' '
|
|||
grep "Cannot merge binary files" merge.err
|
||||
'
|
||||
|
||||
sed -e "s/deerit.\$/deerit;/" -e "s/me;\$/me./" < new5.txt > new6.txt
|
||||
sed -e "s/deerit.\$/deerit,/" -e "s/me;\$/me,/" < new5.txt > new7.txt
|
||||
|
||||
test_expect_success 'MERGE_ZEALOUS simplifies non-conflicts' '
|
||||
sed -e "s/deerit.\$/deerit;/" -e "s/me;\$/me./" <new5.txt >new6.txt &&
|
||||
sed -e "s/deerit.\$/deerit,/" -e "s/me;\$/me,/" <new5.txt >new7.txt &&
|
||||
|
||||
test_must_fail git merge-file -p new6.txt new5.txt new7.txt > output &&
|
||||
test 1 = $(grep ======= <output | wc -l)
|
||||
|
||||
'
|
||||
|
||||
sed -e 's/deerit./&%%%%/' -e "s/locavit,/locavit;/"< new6.txt | tr '%' '\012' > new8.txt
|
||||
sed -e 's/deerit./&%%%%/' -e "s/locavit,/locavit --/" < new7.txt | tr '%' '\012' > new9.txt
|
||||
|
||||
test_expect_success 'ZEALOUS_ALNUM' '
|
||||
sed -e "s/deerit./&%%%%/" -e "s/locavit,/locavit;/" <new6.txt | tr % "\012" >new8.txt &&
|
||||
sed -e "s/deerit./&%%%%/" -e "s/locavit,/locavit --/" <new7.txt | tr % "\012" >new9.txt &&
|
||||
|
||||
test_must_fail git merge-file -p \
|
||||
new8.txt new5.txt new9.txt >merge.out &&
|
||||
test 1 = $(grep ======= <merge.out | wc -l)
|
||||
|
||||
'
|
||||
|
||||
cat >expect <<\EOF
|
||||
test_expect_success '"diff3 -m" style output (1)' '
|
||||
cat >expect <<-\EOF &&
|
||||
Dominus regit me,
|
||||
<<<<<<< new8.txt
|
||||
et nihil mihi deerit;
|
||||
|
@ -277,7 +303,6 @@ non timebo mala, quoniam TU mecum es:
|
|||
virga tua et baculus tuus ipsa me consolata sunt.
|
||||
EOF
|
||||
|
||||
test_expect_success '"diff3 -m" style output (1)' '
|
||||
test_must_fail git merge-file -p --diff3 \
|
||||
new8.txt new5.txt new9.txt >actual &&
|
||||
test_cmp expect actual
|
||||
|
@ -290,7 +315,8 @@ test_expect_success '"diff3 -m" style output (2)' '
|
|||
test_cmp expect actual
|
||||
'
|
||||
|
||||
cat >expect <<\EOF
|
||||
test_expect_success 'marker size' '
|
||||
cat >expect <<-\EOF &&
|
||||
Dominus regit me,
|
||||
<<<<<<<<<< new8.txt
|
||||
et nihil mihi deerit;
|
||||
|
@ -321,30 +347,32 @@ non timebo mala, quoniam TU mecum es:
|
|||
virga tua et baculus tuus ipsa me consolata sunt.
|
||||
EOF
|
||||
|
||||
test_expect_success 'marker size' '
|
||||
test_must_fail git merge-file -p --marker-size=10 \
|
||||
new8.txt new5.txt new9.txt >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
printf "line1\nline2\nline3" >nolf-orig.txt
|
||||
printf "line1\nline2\nline3x" >nolf-diff1.txt
|
||||
printf "line1\nline2\nline3y" >nolf-diff2.txt
|
||||
test_expect_success 'conflict at EOF without LF resolved by --ours' '
|
||||
printf "line1\nline2\nline3" >nolf-orig.txt &&
|
||||
printf "line1\nline2\nline3x" >nolf-diff1.txt &&
|
||||
printf "line1\nline2\nline3y" >nolf-diff2.txt &&
|
||||
|
||||
test_expect_success 'conflict at EOF without LF resolved by --ours' \
|
||||
'git merge-file -p --ours nolf-diff1.txt nolf-orig.txt nolf-diff2.txt >output.txt &&
|
||||
git merge-file -p --ours nolf-diff1.txt nolf-orig.txt nolf-diff2.txt >output.txt &&
|
||||
printf "line1\nline2\nline3x" >expect.txt &&
|
||||
test_cmp expect.txt output.txt'
|
||||
test_cmp expect.txt output.txt
|
||||
'
|
||||
|
||||
test_expect_success 'conflict at EOF without LF resolved by --theirs' \
|
||||
'git merge-file -p --theirs nolf-diff1.txt nolf-orig.txt nolf-diff2.txt >output.txt &&
|
||||
test_expect_success 'conflict at EOF without LF resolved by --theirs' '
|
||||
git merge-file -p --theirs nolf-diff1.txt nolf-orig.txt nolf-diff2.txt >output.txt &&
|
||||
printf "line1\nline2\nline3y" >expect.txt &&
|
||||
test_cmp expect.txt output.txt'
|
||||
test_cmp expect.txt output.txt
|
||||
'
|
||||
|
||||
test_expect_success 'conflict at EOF without LF resolved by --union' \
|
||||
'git merge-file -p --union nolf-diff1.txt nolf-orig.txt nolf-diff2.txt >output.txt &&
|
||||
test_expect_success 'conflict at EOF without LF resolved by --union' '
|
||||
git merge-file -p --union nolf-diff1.txt nolf-orig.txt nolf-diff2.txt >output.txt &&
|
||||
printf "line1\nline2\nline3x\nline3y" >expect.txt &&
|
||||
test_cmp expect.txt output.txt'
|
||||
test_cmp expect.txt output.txt
|
||||
'
|
||||
|
||||
test_expect_success 'conflict sections match existing line endings' '
|
||||
printf "1\\r\\n2\\r\\n3" >crlf-orig.txt &&
|
||||
|
|
|
@ -32,7 +32,29 @@ test_expect_success setup '
|
|||
test_tick &&
|
||||
git commit -m Side &&
|
||||
|
||||
git tag anchor
|
||||
git tag anchor &&
|
||||
|
||||
cat >./custom-merge <<-\EOF &&
|
||||
#!/bin/sh
|
||||
|
||||
orig="$1" ours="$2" theirs="$3" exit="$4" path=$5
|
||||
(
|
||||
echo "orig is $orig"
|
||||
echo "ours is $ours"
|
||||
echo "theirs is $theirs"
|
||||
echo "path is $path"
|
||||
echo "=== orig ==="
|
||||
cat "$orig"
|
||||
echo "=== ours ==="
|
||||
cat "$ours"
|
||||
echo "=== theirs ==="
|
||||
cat "$theirs"
|
||||
) >"$ours+"
|
||||
cat "$ours+" >"$ours"
|
||||
rm -f "$ours+"
|
||||
exit "$exit"
|
||||
EOF
|
||||
chmod +x ./custom-merge
|
||||
'
|
||||
|
||||
test_expect_success merge '
|
||||
|
@ -82,28 +104,6 @@ test_expect_success 'retry the merge with longer context' '
|
|||
grep "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" actual
|
||||
'
|
||||
|
||||
cat >./custom-merge <<\EOF
|
||||
#!/bin/sh
|
||||
|
||||
orig="$1" ours="$2" theirs="$3" exit="$4" path=$5
|
||||
(
|
||||
echo "orig is $orig"
|
||||
echo "ours is $ours"
|
||||
echo "theirs is $theirs"
|
||||
echo "path is $path"
|
||||
echo "=== orig ==="
|
||||
cat "$orig"
|
||||
echo "=== ours ==="
|
||||
cat "$ours"
|
||||
echo "=== theirs ==="
|
||||
cat "$theirs"
|
||||
) >"$ours+"
|
||||
cat "$ours+" >"$ours"
|
||||
rm -f "$ours+"
|
||||
exit "$exit"
|
||||
EOF
|
||||
chmod +x ./custom-merge
|
||||
|
||||
test_expect_success 'custom merge backend' '
|
||||
|
||||
echo "* merge=union" >.gitattributes &&
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
test_description='Merge-recursive merging renames'
|
||||
. ./test-lib.sh
|
||||
|
||||
test_expect_success setup \
|
||||
'
|
||||
cat >A <<\EOF &&
|
||||
test_expect_success 'setup' '
|
||||
cat >A <<-\EOF &&
|
||||
a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
c cccccccccccccccccccccccccccccccccccccccccccccccc
|
||||
|
@ -23,7 +22,7 @@ n nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
|
|||
o oooooooooooooooooooooooooooooooooooooooooooooooo
|
||||
EOF
|
||||
|
||||
cat >M <<\EOF &&
|
||||
cat >M <<-\EOF &&
|
||||
A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
B BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
||||
C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
|
||||
|
@ -66,11 +65,11 @@ mv B A &&
|
|||
git update-index A &&
|
||||
git commit -m "blue modify A" &&
|
||||
|
||||
git checkout master'
|
||||
git checkout master
|
||||
'
|
||||
|
||||
# This test broke in 65ac6e9c3f47807cb603af07a6a9e1a43bc119ae
|
||||
test_expect_success 'merge white into red (A->B,M->N)' \
|
||||
'
|
||||
test_expect_success 'merge white into red (A->B,M->N)' '
|
||||
git checkout -b red-white red &&
|
||||
git merge white &&
|
||||
git write-tree &&
|
||||
|
@ -82,8 +81,7 @@ test_expect_success 'merge white into red (A->B,M->N)' \
|
|||
'
|
||||
|
||||
# This test broke in 8371234ecaaf6e14fe3f2082a855eff1bbd79ae9
|
||||
test_expect_success 'merge blue into white (A->B, mod A, A untracked)' \
|
||||
'
|
||||
test_expect_success 'merge blue into white (A->B, mod A, A untracked)' '
|
||||
git checkout -b white-blue white &&
|
||||
echo dirty >A &&
|
||||
git merge blue &&
|
||||
|
|
Loading…
Reference in New Issue