about summary refs log tree commit diff
path: root/third_party/git/t/t6042-merge-rename-corner-cases.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/t6042-merge-rename-corner-cases.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/t6042-merge-rename-corner-cases.sh')
-rwxr-xr-xthird_party/git/t/t6042-merge-rename-corner-cases.sh111
1 files changed, 44 insertions, 67 deletions
diff --git a/third_party/git/t/t6042-merge-rename-corner-cases.sh b/third_party/git/t/t6042-merge-rename-corner-cases.sh
index b047cf1c1c37..c5b57f40c3d1 100755
--- a/third_party/git/t/t6042-merge-rename-corner-cases.sh
+++ b/third_party/git/t/t6042-merge-rename-corner-cases.sh
@@ -5,7 +5,7 @@ test_description="recursive merge corner cases w/ renames but not criss-crosses"
 
 . ./test-lib.sh
 
-test_setup_rename_delete_untracked () {
+test_expect_success 'setup rename/delete + untracked file' '
 	test_create_repo rename-delete-untracked &&
 	(
 		cd rename-delete-untracked &&
@@ -29,10 +29,9 @@ test_setup_rename_delete_untracked () {
 		git commit -m track-people-instead-of-objects &&
 		echo "Myyy PRECIOUSSS" >ring
 	)
-}
+'
 
 test_expect_success "Does git preserve Gollum's precious artifact?" '
-	test_setup_rename_delete_untracked &&
 	(
 		cd rename-delete-untracked &&
 
@@ -50,7 +49,7 @@ test_expect_success "Does git preserve Gollum's precious artifact?" '
 #
 # We should be able to merge B & C cleanly
 
-test_setup_rename_modify_add_source () {
+test_expect_success 'setup rename/modify/add-source conflict' '
 	test_create_repo rename-modify-add-source &&
 	(
 		cd rename-modify-add-source &&
@@ -71,10 +70,9 @@ test_setup_rename_modify_add_source () {
 		git add a &&
 		git commit -m C
 	)
-}
+'
 
 test_expect_failure 'rename/modify/add-source conflict resolvable' '
-	test_setup_rename_modify_add_source &&
 	(
 		cd rename-modify-add-source &&
 
@@ -90,7 +88,7 @@ test_expect_failure 'rename/modify/add-source conflict resolvable' '
 	)
 '
 
-test_setup_break_detection_1 () {
+test_expect_success 'setup resolvable conflict missed if rename missed' '
 	test_create_repo break-detection-1 &&
 	(
 		cd break-detection-1 &&
@@ -112,10 +110,9 @@ test_setup_break_detection_1 () {
 		git add a &&
 		git commit -m C
 	)
-}
+'
 
 test_expect_failure 'conflict caused if rename not detected' '
-	test_setup_break_detection_1 &&
 	(
 		cd break-detection-1 &&
 
@@ -138,7 +135,7 @@ test_expect_failure 'conflict caused if rename not detected' '
 	)
 '
 
-test_setup_break_detection_2 () {
+test_expect_success 'setup conflict resolved wrong if rename missed' '
 	test_create_repo break-detection-2 &&
 	(
 		cd break-detection-2 &&
@@ -163,10 +160,9 @@ test_setup_break_detection_2 () {
 		git add a &&
 		git commit -m E
 	)
-}
+'
 
 test_expect_failure 'missed conflict if rename not detected' '
-	test_setup_break_detection_2 &&
 	(
 		cd break-detection-2 &&
 
@@ -186,7 +182,7 @@ test_expect_failure 'missed conflict if rename not detected' '
 #   Commit B: rename a->b
 #   Commit C: rename a->b, add unrelated a
 
-test_setup_break_detection_3 () {
+test_expect_success 'setup undetected rename/add-source causes data loss' '
 	test_create_repo break-detection-3 &&
 	(
 		cd break-detection-3 &&
@@ -206,10 +202,9 @@ test_setup_break_detection_3 () {
 		git add a &&
 		git commit -m C
 	)
-}
+'
 
 test_expect_failure 'detect rename/add-source and preserve all data' '
-	test_setup_break_detection_3 &&
 	(
 		cd break-detection-3 &&
 
@@ -236,7 +231,6 @@ test_expect_failure 'detect rename/add-source and preserve all data' '
 '
 
 test_expect_failure 'detect rename/add-source and preserve all data, merge other way' '
-	test_setup_break_detection_3 &&
 	(
 		cd break-detection-3 &&
 
@@ -262,10 +256,10 @@ test_expect_failure 'detect rename/add-source and preserve all data, merge other
 	)
 '
 
-test_setup_rename_directory () {
-	test_create_repo rename-directory-$1 &&
+test_expect_success 'setup content merge + rename/directory conflict' '
+	test_create_repo rename-directory-1 &&
 	(
-		cd rename-directory-$1 &&
+		cd rename-directory-1 &&
 
 		printf "1\n2\n3\n4\n5\n6\n" >file &&
 		git add file &&
@@ -296,12 +290,11 @@ test_setup_rename_directory () {
 		test_tick &&
 		git commit -m left
 	)
-}
+'
 
 test_expect_success 'rename/directory conflict + clean content merge' '
-	test_setup_rename_directory 1a &&
 	(
-		cd rename-directory-1a &&
+		cd rename-directory-1 &&
 
 		git checkout left-clean^0 &&
 
@@ -327,9 +320,8 @@ test_expect_success 'rename/directory conflict + clean content merge' '
 '
 
 test_expect_success 'rename/directory conflict + content merge conflict' '
-	test_setup_rename_directory 1b &&
 	(
-		cd rename-directory-1b &&
+		cd rename-directory-1 &&
 
 		git reset --hard &&
 		git clean -fdqx &&
@@ -366,7 +358,7 @@ test_expect_success 'rename/directory conflict + content merge conflict' '
 	)
 '
 
-test_setup_rename_directory_2 () {
+test_expect_success 'setup content merge + rename/directory conflict w/ disappearing dir' '
 	test_create_repo rename-directory-2 &&
 	(
 		cd rename-directory-2 &&
@@ -393,10 +385,9 @@ test_setup_rename_directory_2 () {
 		test_tick &&
 		git commit -m left
 	)
-}
+'
 
 test_expect_success 'disappearing dir in rename/directory conflict handled' '
-	test_setup_rename_directory_2 &&
 	(
 		cd rename-directory-2 &&
 
@@ -425,10 +416,10 @@ test_expect_success 'disappearing dir in rename/directory conflict handled' '
 #   Commit A: rename a->b, modifying b too
 #   Commit B: modify a, add different b
 
-test_setup_rename_with_content_merge_and_add () {
-	test_create_repo rename-with-content-merge-and-add-$1 &&
+test_expect_success 'setup rename-with-content-merge vs. add' '
+	test_create_repo rename-with-content-merge-and-add &&
 	(
-		cd rename-with-content-merge-and-add-$1 &&
+		cd rename-with-content-merge-and-add &&
 
 		test_seq 1 5 >a &&
 		git add a &&
@@ -447,12 +438,11 @@ test_setup_rename_with_content_merge_and_add () {
 		git add a b &&
 		git commit -m B
 	)
-}
+'
 
 test_expect_success 'handle rename-with-content-merge vs. add' '
-	test_setup_rename_with_content_merge_and_add AB &&
 	(
-		cd rename-with-content-merge-and-add-AB &&
+		cd rename-with-content-merge-and-add &&
 
 		git checkout A^0 &&
 
@@ -493,9 +483,8 @@ test_expect_success 'handle rename-with-content-merge vs. add' '
 '
 
 test_expect_success 'handle rename-with-content-merge vs. add, merge other way' '
-	test_setup_rename_with_content_merge_and_add BA &&
 	(
-		cd rename-with-content-merge-and-add-BA &&
+		cd rename-with-content-merge-and-add &&
 
 		git reset --hard &&
 		git clean -fdx &&
@@ -550,7 +539,7 @@ test_expect_success 'handle rename-with-content-merge vs. add, merge other way'
 #   * The working copy should have two files, both of form c~<unique>; does it?
 #   * Nothing else should be present.  Is anything?
 
-test_setup_rename_rename_2to1 () {
+test_expect_success 'setup rename/rename (2to1) + modify/modify' '
 	test_create_repo rename-rename-2to1 &&
 	(
 		cd rename-rename-2to1 &&
@@ -573,10 +562,9 @@ test_setup_rename_rename_2to1 () {
 		git add a &&
 		git commit -m C
 	)
-}
+'
 
 test_expect_success 'handle rename/rename (2to1) conflict correctly' '
-	test_setup_rename_rename_2to1 &&
 	(
 		cd rename-rename-2to1 &&
 
@@ -622,7 +610,7 @@ test_expect_success 'handle rename/rename (2to1) conflict correctly' '
 #   Commit A: new file: a
 #   Commit B: rename a->b
 #   Commit C: rename a->c
-test_setup_rename_rename_1to2 () {
+test_expect_success 'setup simple rename/rename (1to2) conflict' '
 	test_create_repo rename-rename-1to2 &&
 	(
 		cd rename-rename-1to2 &&
@@ -643,10 +631,9 @@ test_setup_rename_rename_1to2 () {
 		test_tick &&
 		git commit -m C
 	)
-}
+'
 
 test_expect_success 'merge has correct working tree contents' '
-	test_setup_rename_rename_1to2 &&
 	(
 		cd rename-rename-1to2 &&
 
@@ -680,7 +667,7 @@ test_expect_success 'merge has correct working tree contents' '
 #
 # Merging of B & C should NOT be clean; there's a rename/rename conflict
 
-test_setup_rename_rename_1to2_add_source_1 () {
+test_expect_success 'setup rename/rename(1to2)/add-source conflict' '
 	test_create_repo rename-rename-1to2-add-source-1 &&
 	(
 		cd rename-rename-1to2-add-source-1 &&
@@ -700,10 +687,9 @@ test_setup_rename_rename_1to2_add_source_1 () {
 		git add a &&
 		git commit -m C
 	)
-}
+'
 
 test_expect_failure 'detect conflict with rename/rename(1to2)/add-source merge' '
-	test_setup_rename_rename_1to2_add_source_1 &&
 	(
 		cd rename-rename-1to2-add-source-1 &&
 
@@ -728,7 +714,7 @@ test_expect_failure 'detect conflict with rename/rename(1to2)/add-source merge'
 	)
 '
 
-test_setup_rename_rename_1to2_add_source_2 () {
+test_expect_success 'setup rename/rename(1to2)/add-source resolvable conflict' '
 	test_create_repo rename-rename-1to2-add-source-2 &&
 	(
 		cd rename-rename-1to2-add-source-2 &&
@@ -751,10 +737,9 @@ test_setup_rename_rename_1to2_add_source_2 () {
 		test_tick &&
 		git commit -m two
 	)
-}
+'
 
 test_expect_failure 'rename/rename/add-source still tracks new a file' '
-	test_setup_rename_rename_1to2_add_source_2 &&
 	(
 		cd rename-rename-1to2-add-source-2 &&
 
@@ -774,7 +759,7 @@ test_expect_failure 'rename/rename/add-source still tracks new a file' '
 	)
 '
 
-test_setup_rename_rename_1to2_add_dest () {
+test_expect_success 'setup rename/rename(1to2)/add-dest conflict' '
 	test_create_repo rename-rename-1to2-add-dest &&
 	(
 		cd rename-rename-1to2-add-dest &&
@@ -799,10 +784,9 @@ test_setup_rename_rename_1to2_add_dest () {
 		test_tick &&
 		git commit -m two
 	)
-}
+'
 
 test_expect_success 'rename/rename/add-dest merge still knows about conflicting file versions' '
-	test_setup_rename_rename_1to2_add_dest &&
 	(
 		cd rename-rename-1to2-add-dest &&
 
@@ -854,7 +838,7 @@ test_expect_success 'rename/rename/add-dest merge still knows about conflicting
 #   Commit B: rename foo->bar
 #   Expected: CONFLICT (rename/add/delete), two-way merged bar
 
-test_setup_rad () {
+test_expect_success 'rad-setup: rename/add/delete conflict' '
 	test_create_repo rad &&
 	(
 		cd rad &&
@@ -876,10 +860,9 @@ test_setup_rad () {
 		git mv foo bar &&
 		git commit -m "rename foo to bar"
 	)
-}
+'
 
 test_expect_failure 'rad-check: rename/add/delete conflict' '
-	test_setup_rad &&
 	(
 		cd rad &&
 
@@ -921,7 +904,7 @@ test_expect_failure 'rad-check: rename/add/delete conflict' '
 #   Commit B: rename bar->baz, rm foo
 #   Expected: CONFLICT (rename/rename/delete/delete), two-way merged baz
 
-test_setup_rrdd () {
+test_expect_success 'rrdd-setup: rename/rename(2to1)/delete/delete conflict' '
 	test_create_repo rrdd &&
 	(
 		cd rrdd &&
@@ -944,10 +927,9 @@ test_setup_rrdd () {
 		git rm foo &&
 		git commit -m "Rename bar, remove foo"
 	)
-}
+'
 
 test_expect_failure 'rrdd-check: rename/rename(2to1)/delete/delete conflict' '
-	test_setup_rrdd &&
 	(
 		cd rrdd &&
 
@@ -991,7 +973,7 @@ test_expect_failure 'rrdd-check: rename/rename(2to1)/delete/delete conflict' '
 #   Expected: six CONFLICT(rename/rename) messages, each path in two of the
 #             multi-way merged contents found in two, four, six
 
-test_setup_mod6 () {
+test_expect_success 'mod6-setup: chains of rename/rename(1to2) and rename/rename(2to1)' '
 	test_create_repo mod6 &&
 	(
 		cd mod6 &&
@@ -1027,10 +1009,9 @@ test_setup_mod6 () {
 		test_tick &&
 		git commit -m "B"
 	)
-}
+'
 
 test_expect_failure 'mod6-check: chains of rename/rename(1to2) and rename/rename(2to1)' '
-	test_setup_mod6 &&
 	(
 		cd mod6 &&
 
@@ -1127,8 +1108,7 @@ test_conflicts_with_adds_and_renames() {
 	#      files.  Is it present?
 	#   4) There should not be any three~* files in the working
 	#      tree
-	test_setup_collision_conflict () {
-	#test_expect_success "setup simple $sideL/$sideR conflict" '
+	test_expect_success "setup simple $sideL/$sideR conflict" '
 		test_create_repo simple_${sideL}_${sideR} &&
 		(
 			cd simple_${sideL}_${sideR} &&
@@ -1205,11 +1185,9 @@ test_conflicts_with_adds_and_renames() {
 			fi &&
 			test_tick && git commit -m R
 		)
-	#'
-	}
+	'
 
 	test_expect_success "check simple $sideL/$sideR conflict" '
-		test_setup_collision_conflict &&
 		(
 			cd simple_${sideL}_${sideR} &&
 
@@ -1276,7 +1254,7 @@ test_conflicts_with_adds_and_renames add    add
 #
 #   So, we have four different conflicting files that all end up at path
 #   'three'.
-test_setup_nested_conflicts_from_rename_rename () {
+test_expect_success 'setup nested conflicts from rename/rename(2to1)' '
 	test_create_repo nested_conflicts_from_rename_rename &&
 	(
 		cd nested_conflicts_from_rename_rename &&
@@ -1327,10 +1305,9 @@ test_setup_nested_conflicts_from_rename_rename () {
 		git add one three &&
 		test_tick && git commit -m german
 	)
-}
+'
 
 test_expect_success 'check nested conflicts from rename/rename(2to1)' '
-	test_setup_nested_conflicts_from_rename_rename &&
 	(
 		cd nested_conflicts_from_rename_rename &&