about summary refs log tree commit diff
path: root/third_party/git/t/t4108-apply-threeway.sh
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-25T23·06+0100
committerVincent Ambo <tazjin@google.com>2020-05-25T23·06+0100
commit93ba78d6f4632ef1c5228965e3edc8c0faf88c1e (patch)
tree85730c182a9f5f492ade8e8ccdb1c2356f9900bd /third_party/git/t/t4108-apply-threeway.sh
parent6f8fbf4aa4b1654ab27d4829e114538761817de0 (diff)
revert(3p/git): Revert merge of git upstream at v2.26.2 r/852
This causes cgit to serve error pages, which is undesirable.

This reverts commit 5229c9b232de5bfa959ad6ebbb4c8192ac513352, reversing
changes made to f2b211131f2347342dde63975b09cf603149f1a3.
Diffstat (limited to 'third_party/git/t/t4108-apply-threeway.sh')
-rwxr-xr-xthird_party/git/t/t4108-apply-threeway.sh55
1 files changed, 26 insertions, 29 deletions
diff --git a/third_party/git/t/t4108-apply-threeway.sh b/third_party/git/t/t4108-apply-threeway.sh
index d7349ced6be0..fa5d4efb89dc 100755
--- a/third_party/git/t/t4108-apply-threeway.sh
+++ b/third_party/git/t/t4108-apply-threeway.sh
@@ -4,17 +4,23 @@ test_description='git apply --3way'
 
 . ./test-lib.sh
 
-print_sanitized_conflicted_diff () {
-	git diff HEAD >diff.raw &&
+create_file () {
+	for i
+	do
+		echo "$i"
+	done
+}
+
+sanitize_conflicted_diff () {
 	sed -e '
 		/^index /d
-		s/^\(+[<>|][<>|][<>|][<>|]*\) .*/\1/
-	' diff.raw
+		s/^\(+[<>][<>][<>][<>]*\) .*/\1/
+	'
 }
 
 test_expect_success setup '
 	test_tick &&
-	test_write_lines 1 2 3 4 5 6 7 >one &&
+	create_file >one 1 2 3 4 5 6 7 &&
 	cat one >two &&
 	git add one two &&
 	git commit -m initial &&
@@ -22,13 +28,13 @@ test_expect_success setup '
 	git branch side &&
 
 	test_tick &&
-	test_write_lines 1 two 3 4 5 six 7 >one &&
-	test_write_lines 1 two 3 4 5 6 7 >two &&
+	create_file >one 1 two 3 4 5 six 7 &&
+	create_file >two 1 two 3 4 5 6 7 &&
 	git commit -a -m master &&
 
 	git checkout side &&
-	test_write_lines 1 2 3 4 five 6 7 >one &&
-	test_write_lines 1 2 3 4 five 6 7 >two &&
+	create_file >one 1 2 3 4 five 6 7 &&
+	create_file >two 1 2 3 4 five 6 7 &&
 	git commit -a -m side &&
 
 	git checkout master
@@ -46,7 +52,7 @@ test_expect_success 'apply without --3way' '
 	git diff-index --exit-code --cached HEAD
 '
 
-test_apply_with_3way () {
+test_expect_success 'apply with --3way' '
 	# Merging side should be similar to applying this patch
 	git diff ...side >P.diff &&
 
@@ -55,31 +61,22 @@ test_apply_with_3way () {
 	git checkout master^0 &&
 	test_must_fail git merge --no-commit side &&
 	git ls-files -s >expect.ls &&
-	print_sanitized_conflicted_diff >expect.diff &&
+	git diff HEAD | sanitize_conflicted_diff >expect.diff &&
 
 	# should fail to apply
 	git reset --hard &&
 	git checkout master^0 &&
 	test_must_fail git apply --index --3way P.diff &&
 	git ls-files -s >actual.ls &&
-	print_sanitized_conflicted_diff >actual.diff &&
+	git diff HEAD | sanitize_conflicted_diff >actual.diff &&
 
 	# The result should resemble the corresponding merge
 	test_cmp expect.ls actual.ls &&
 	test_cmp expect.diff actual.diff
-}
-
-test_expect_success 'apply with --3way' '
-	test_apply_with_3way
-'
-
-test_expect_success 'apply with --3way with merge.conflictStyle = diff3' '
-	test_config merge.conflictStyle diff3 &&
-	test_apply_with_3way
 '
 
 test_expect_success 'apply with --3way with rerere enabled' '
-	test_config rerere.enabled true &&
+	git config rerere.enabled true &&
 
 	# Merging side should be similar to applying this patch
 	git diff ...side >P.diff &&
@@ -90,7 +87,7 @@ test_expect_success 'apply with --3way with rerere enabled' '
 	test_must_fail git merge --no-commit side &&
 
 	# Manually resolve and record the resolution
-	test_write_lines 1 two 3 4 five six 7 >one &&
+	create_file 1 two 3 4 five six 7 >one &&
 	git rerere &&
 	cat one >expect &&
 
@@ -107,14 +104,14 @@ test_expect_success 'apply -3 with add/add conflict setup' '
 	git reset --hard &&
 
 	git checkout -b adder &&
-	test_write_lines 1 2 3 4 5 6 7 >three &&
-	test_write_lines 1 2 3 4 5 6 7 >four &&
+	create_file 1 2 3 4 5 6 7 >three &&
+	create_file 1 2 3 4 5 6 7 >four &&
 	git add three four &&
 	git commit -m "add three and four" &&
 
 	git checkout -b another adder^ &&
-	test_write_lines 1 2 3 4 5 6 7 >three &&
-	test_write_lines 1 2 3 four 5 6 7 >four &&
+	create_file 1 2 3 4 5 6 7 >three &&
+	create_file 1 2 3 four 5 6 7 >four &&
 	git add three four &&
 	git commit -m "add three and four" &&
 
@@ -124,7 +121,7 @@ test_expect_success 'apply -3 with add/add conflict setup' '
 	git checkout adder^0 &&
 	test_must_fail git merge --no-commit another &&
 	git ls-files -s >expect.ls &&
-	print_sanitized_conflicted_diff >expect.diff
+	git diff HEAD | sanitize_conflicted_diff >expect.diff
 '
 
 test_expect_success 'apply -3 with add/add conflict' '
@@ -134,7 +131,7 @@ test_expect_success 'apply -3 with add/add conflict' '
 	test_must_fail git apply --index --3way P.diff &&
 	# ... and leave conflicts in the index and in the working tree
 	git ls-files -s >actual.ls &&
-	print_sanitized_conflicted_diff >actual.diff &&
+	git diff HEAD | sanitize_conflicted_diff >actual.diff &&
 
 	# The result should resemble the corresponding merge
 	test_cmp expect.ls actual.ls &&