Transform the setup "tests" to setup functions, and have the actual
tests call the setup functions. Advantages:
* Should make life easier for people working with webby CI/PR builds
who have to abuse mice (and their own index finger as well) in
order to switch from viewing one testcase to another. Sounds
awful; hopefully this will improve things for them.
* Improves re-runnability: any failed test in any of these three
files can now be re-run in isolation, e.g.
./t6042* --ver --imm -x --run=21
whereas before it would require two tests to be specified to the
--run argument, the other needing to be picked out as the relevant
setup test from one or two tests before.
* Importantly, this still keeps the "setup" and "test" sections
somewhat separate to make it easier for readers to discern what is
just ancillary setup and what the intent of the test is.
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-test_expect_success 'setup rename/delete + untracked file' '
+test_setup_rename_delete_untracked () {
test_create_repo rename-delete-untracked &&
(
cd rename-delete-untracked &&
test_create_repo rename-delete-untracked &&
(
cd rename-delete-untracked &&
git commit -m track-people-instead-of-objects &&
echo "Myyy PRECIOUSSS" >ring
)
git commit -m track-people-instead-of-objects &&
echo "Myyy PRECIOUSSS" >ring
)
test_expect_success "Does git preserve Gollum's precious artifact?" '
test_expect_success "Does git preserve Gollum's precious artifact?" '
+ test_setup_rename_delete_untracked &&
(
cd rename-delete-untracked &&
(
cd rename-delete-untracked &&
#
# We should be able to merge B & C cleanly
#
# We should be able to merge B & C cleanly
-test_expect_success 'setup rename/modify/add-source conflict' '
+test_setup_rename_modify_add_source () {
test_create_repo rename-modify-add-source &&
(
cd rename-modify-add-source &&
test_create_repo rename-modify-add-source &&
(
cd rename-modify-add-source &&
git add a &&
git commit -m C
)
git add a &&
git commit -m C
)
test_expect_failure 'rename/modify/add-source conflict resolvable' '
test_expect_failure 'rename/modify/add-source conflict resolvable' '
+ test_setup_rename_modify_add_source &&
(
cd rename-modify-add-source &&
(
cd rename-modify-add-source &&
-test_expect_success 'setup resolvable conflict missed if rename missed' '
+test_setup_break_detection_1 () {
test_create_repo break-detection-1 &&
(
cd break-detection-1 &&
test_create_repo break-detection-1 &&
(
cd break-detection-1 &&
git add a &&
git commit -m C
)
git add a &&
git commit -m C
)
test_expect_failure 'conflict caused if rename not detected' '
test_expect_failure 'conflict caused if rename not detected' '
+ test_setup_break_detection_1 &&
(
cd break-detection-1 &&
(
cd break-detection-1 &&
-test_expect_success 'setup conflict resolved wrong if rename missed' '
+test_setup_break_detection_2 () {
test_create_repo break-detection-2 &&
(
cd break-detection-2 &&
test_create_repo break-detection-2 &&
(
cd break-detection-2 &&
git add a &&
git commit -m E
)
git add a &&
git commit -m E
)
test_expect_failure 'missed conflict if rename not detected' '
test_expect_failure 'missed conflict if rename not detected' '
+ test_setup_break_detection_2 &&
(
cd break-detection-2 &&
(
cd break-detection-2 &&
# Commit B: rename a->b
# Commit C: rename a->b, add unrelated a
# Commit B: rename a->b
# Commit C: rename a->b, add unrelated a
-test_expect_success 'setup undetected rename/add-source causes data loss' '
+test_setup_break_detection_3 () {
test_create_repo break-detection-3 &&
(
cd break-detection-3 &&
test_create_repo break-detection-3 &&
(
cd break-detection-3 &&
git add a &&
git commit -m C
)
git add a &&
git commit -m C
)
test_expect_failure 'detect rename/add-source and preserve all data' '
test_expect_failure 'detect rename/add-source and preserve all data' '
+ test_setup_break_detection_3 &&
(
cd break-detection-3 &&
(
cd break-detection-3 &&
'
test_expect_failure 'detect rename/add-source and preserve all data, merge other way' '
'
test_expect_failure 'detect rename/add-source and preserve all data, merge other way' '
+ test_setup_break_detection_3 &&
(
cd break-detection-3 &&
(
cd break-detection-3 &&
-test_expect_success 'setup content merge + rename/directory conflict' '
- test_create_repo rename-directory-1 &&
+test_setup_rename_directory () {
+ 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 &&
printf "1\n2\n3\n4\n5\n6\n" >file &&
git add file &&
test_tick &&
git commit -m left
)
test_tick &&
git commit -m left
)
test_expect_success 'rename/directory conflict + clean content merge' '
test_expect_success 'rename/directory conflict + clean content merge' '
+ test_setup_rename_directory 1a &&
- cd rename-directory-1 &&
+ cd rename-directory-1a &&
git checkout left-clean^0 &&
git checkout left-clean^0 &&
'
test_expect_success 'rename/directory conflict + content merge conflict' '
'
test_expect_success 'rename/directory conflict + content merge conflict' '
+ test_setup_rename_directory 1b &&
- cd rename-directory-1 &&
+ cd rename-directory-1b &&
git reset --hard &&
git clean -fdqx &&
git reset --hard &&
git clean -fdqx &&
-test_expect_success 'setup content merge + rename/directory conflict w/ disappearing dir' '
+test_setup_rename_directory_2 () {
test_create_repo rename-directory-2 &&
(
cd rename-directory-2 &&
test_create_repo rename-directory-2 &&
(
cd rename-directory-2 &&
test_tick &&
git commit -m left
)
test_tick &&
git commit -m left
)
test_expect_success 'disappearing dir in rename/directory conflict handled' '
test_expect_success 'disappearing dir in rename/directory conflict handled' '
+ test_setup_rename_directory_2 &&
(
cd rename-directory-2 &&
(
cd rename-directory-2 &&
# Commit A: rename a->b, modifying b too
# Commit B: modify a, add different b
# Commit A: rename a->b, modifying b too
# Commit B: modify a, add different b
-test_expect_success 'setup rename-with-content-merge vs. add' '
- test_create_repo rename-with-content-merge-and-add &&
+test_setup_rename_with_content_merge_and_add () {
+ test_create_repo rename-with-content-merge-and-add-$1 &&
- cd rename-with-content-merge-and-add &&
+ cd rename-with-content-merge-and-add-$1 &&
test_seq 1 5 >a &&
git add a &&
test_seq 1 5 >a &&
git add a &&
git add a b &&
git commit -m B
)
git add a b &&
git commit -m B
)
test_expect_success 'handle rename-with-content-merge vs. add' '
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 &&
+ cd rename-with-content-merge-and-add-AB &&
'
test_expect_success 'handle rename-with-content-merge vs. add, merge other way' '
'
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 &&
+ cd rename-with-content-merge-and-add-BA &&
git reset --hard &&
git clean -fdx &&
git reset --hard &&
git clean -fdx &&
# * The working copy should have two files, both of form c~<unique>; does it?
# * Nothing else should be present. Is anything?
# * The working copy should have two files, both of form c~<unique>; does it?
# * Nothing else should be present. Is anything?
-test_expect_success 'setup rename/rename (2to1) + modify/modify' '
+test_setup_rename_rename_2to1 () {
test_create_repo rename-rename-2to1 &&
(
cd rename-rename-2to1 &&
test_create_repo rename-rename-2to1 &&
(
cd rename-rename-2to1 &&
git add a &&
git commit -m C
)
git add a &&
git commit -m C
)
test_expect_success 'handle rename/rename (2to1) conflict correctly' '
test_expect_success 'handle rename/rename (2to1) conflict correctly' '
+ test_setup_rename_rename_2to1 &&
(
cd rename-rename-2to1 &&
(
cd rename-rename-2to1 &&
# Commit A: new file: a
# Commit B: rename a->b
# Commit C: rename a->c
# Commit A: new file: a
# Commit B: rename a->b
# Commit C: rename a->c
-test_expect_success 'setup simple rename/rename (1to2) conflict' '
+test_setup_rename_rename_1to2 () {
test_create_repo rename-rename-1to2 &&
(
cd rename-rename-1to2 &&
test_create_repo rename-rename-1to2 &&
(
cd rename-rename-1to2 &&
test_tick &&
git commit -m C
)
test_tick &&
git commit -m C
)
test_expect_success 'merge has correct working tree contents' '
test_expect_success 'merge has correct working tree contents' '
+ test_setup_rename_rename_1to2 &&
(
cd rename-rename-1to2 &&
(
cd rename-rename-1to2 &&
#
# Merging of B & C should NOT be clean; there's a rename/rename conflict
#
# Merging of B & C should NOT be clean; there's a rename/rename conflict
-test_expect_success 'setup rename/rename(1to2)/add-source conflict' '
+test_setup_rename_rename_1to2_add_source_1 () {
test_create_repo rename-rename-1to2-add-source-1 &&
(
cd rename-rename-1to2-add-source-1 &&
test_create_repo rename-rename-1to2-add-source-1 &&
(
cd rename-rename-1to2-add-source-1 &&
git add a &&
git commit -m C
)
git add a &&
git commit -m C
)
test_expect_failure 'detect conflict with rename/rename(1to2)/add-source merge' '
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 &&
(
cd rename-rename-1to2-add-source-1 &&
-test_expect_success 'setup rename/rename(1to2)/add-source resolvable conflict' '
+test_setup_rename_rename_1to2_add_source_2 () {
test_create_repo rename-rename-1to2-add-source-2 &&
(
cd rename-rename-1to2-add-source-2 &&
test_create_repo rename-rename-1to2-add-source-2 &&
(
cd rename-rename-1to2-add-source-2 &&
test_tick &&
git commit -m two
)
test_tick &&
git commit -m two
)
test_expect_failure 'rename/rename/add-source still tracks new a file' '
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 &&
(
cd rename-rename-1to2-add-source-2 &&
-test_expect_success 'setup rename/rename(1to2)/add-dest conflict' '
+test_setup_rename_rename_1to2_add_dest () {
test_create_repo rename-rename-1to2-add-dest &&
(
cd rename-rename-1to2-add-dest &&
test_create_repo rename-rename-1to2-add-dest &&
(
cd rename-rename-1to2-add-dest &&
test_tick &&
git commit -m two
)
test_tick &&
git commit -m two
)
test_expect_success 'rename/rename/add-dest merge still knows about conflicting file versions' '
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 &&
(
cd rename-rename-1to2-add-dest &&
# Commit B: rename foo->bar
# Expected: CONFLICT (rename/add/delete), two-way merged bar
# Commit B: rename foo->bar
# Expected: CONFLICT (rename/add/delete), two-way merged bar
-test_expect_success 'rad-setup: rename/add/delete conflict' '
test_create_repo rad &&
(
cd rad &&
test_create_repo rad &&
(
cd rad &&
git mv foo bar &&
git commit -m "rename foo to bar"
)
git mv foo bar &&
git commit -m "rename foo to bar"
)
test_expect_failure 'rad-check: rename/add/delete conflict' '
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
# Commit B: rename bar->baz, rm foo
# Expected: CONFLICT (rename/rename/delete/delete), two-way merged baz
-test_expect_success 'rrdd-setup: rename/rename(2to1)/delete/delete conflict' '
test_create_repo rrdd &&
(
cd rrdd &&
test_create_repo rrdd &&
(
cd rrdd &&
git rm foo &&
git commit -m "Rename bar, remove foo"
)
git rm foo &&
git commit -m "Rename bar, remove foo"
)
test_expect_failure 'rrdd-check: rename/rename(2to1)/delete/delete conflict' '
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
# Expected: six CONFLICT(rename/rename) messages, each path in two of the
# multi-way merged contents found in two, four, six
-test_expect_success 'mod6-setup: chains of rename/rename(1to2) and rename/rename(2to1)' '
test_create_repo mod6 &&
(
cd mod6 &&
test_create_repo mod6 &&
(
cd mod6 &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
test_expect_failure 'mod6-check: chains of rename/rename(1to2) and rename/rename(2to1)' '
test_expect_failure 'mod6-check: chains of rename/rename(1to2) and rename/rename(2to1)' '
# files. Is it present?
# 4) There should not be any three~* files in the working
# tree
# files. Is it present?
# 4) There should not be any three~* files in the working
# tree
- test_expect_success "setup simple $sideL/$sideR conflict" '
+ test_setup_collision_conflict () {
+ #test_expect_success "setup simple $sideL/$sideR conflict" '
test_create_repo simple_${sideL}_${sideR} &&
(
cd simple_${sideL}_${sideR} &&
test_create_repo simple_${sideL}_${sideR} &&
(
cd simple_${sideL}_${sideR} &&
fi &&
test_tick && git commit -m R
)
fi &&
test_tick && git commit -m R
)
test_expect_success "check simple $sideL/$sideR conflict" '
test_expect_success "check simple $sideL/$sideR conflict" '
+ test_setup_collision_conflict &&
(
cd simple_${sideL}_${sideR} &&
(
cd simple_${sideL}_${sideR} &&
#
# So, we have four different conflicting files that all end up at path
# 'three'.
#
# So, we have four different conflicting files that all end up at path
# 'three'.
-test_expect_success 'setup nested conflicts from rename/rename(2to1)' '
+test_setup_nested_conflicts_from_rename_rename () {
test_create_repo nested_conflicts_from_rename_rename &&
(
cd nested_conflicts_from_rename_rename &&
test_create_repo nested_conflicts_from_rename_rename &&
(
cd nested_conflicts_from_rename_rename &&
git add one three &&
test_tick && git commit -m german
)
git add one three &&
test_tick && git commit -m german
)
test_expect_success 'check nested conflicts from rename/rename(2to1)' '
test_expect_success 'check nested conflicts from rename/rename(2to1)' '
+ test_setup_nested_conflicts_from_rename_rename &&
(
cd nested_conflicts_from_rename_rename &&
(
cd nested_conflicts_from_rename_rename &&
# Commit B: z/{b,c,d,e/f}
# Expected: y/{b,c,d,e/f}
# Commit B: z/{b,c,d,e/f}
# Expected: y/{b,c,d,e/f}
-test_expect_success '1a-setup: Simple directory rename detection' '
test_create_repo 1a &&
(
cd 1a &&
test_create_repo 1a &&
(
cd 1a &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '1a-check: Simple directory rename detection' '
+test_expect_success '1a: Simple directory rename detection' '
+ test_setup_1a &&
# Commit B: y/{b,c,d}
# Expected: y/{b,c,d,e}
# Commit B: y/{b,c,d}
# Expected: y/{b,c,d,e}
-test_expect_success '1b-setup: Merge a directory with another' '
test_create_repo 1b &&
(
cd 1b &&
test_create_repo 1b &&
(
cd 1b &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '1b-check: Merge a directory with another' '
+test_expect_success '1b: Merge a directory with another' '
+ test_setup_1b &&
# Commit B: z/{b,c,d}
# Expected: y/{b,c,d} (because x/d -> z/d -> y/d)
# Commit B: z/{b,c,d}
# Expected: y/{b,c,d} (because x/d -> z/d -> y/d)
-test_expect_success '1c-setup: Transitive renaming' '
test_create_repo 1c &&
(
cd 1c &&
test_create_repo 1c &&
(
cd 1c &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '1c-check: Transitive renaming' '
+test_expect_success '1c: Transitive renaming' '
+ test_setup_1c &&
# Note: y/m & z/n should definitely move into x. By the same token, both
# y/wham_1 & z/wham_2 should too...giving us a conflict.
# Note: y/m & z/n should definitely move into x. By the same token, both
# y/wham_1 & z/wham_2 should too...giving us a conflict.
-test_expect_success '1d-setup: Directory renames cause a rename/rename(2to1) conflict' '
test_create_repo 1d &&
(
cd 1d &&
test_create_repo 1d &&
(
cd 1d &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '1d-check: Directory renames cause a rename/rename(2to1) conflict' '
+test_expect_success '1d: Directory renames cause a rename/rename(2to1) conflict' '
+ test_setup_1d &&
# Commit B: z/{oldb,oldc,d}
# Expected: y/{newb,newc,d}
# Commit B: z/{oldb,oldc,d}
# Expected: y/{newb,newc,d}
-test_expect_success '1e-setup: Renamed directory, with all files being renamed too' '
test_create_repo 1e &&
(
cd 1e &&
test_create_repo 1e &&
(
cd 1e &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '1e-check: Renamed directory, with all files being renamed too' '
+test_expect_success '1e: Renamed directory, with all files being renamed too' '
+ test_setup_1e &&
# Commit B: y/{b,c}, x/{d,e,f}
# Expected: y/{b,c}, x/{d,e,f,g}
# Commit B: y/{b,c}, x/{d,e,f}
# Expected: y/{b,c}, x/{d,e,f,g}
-test_expect_success '1f-setup: Split a directory into two other directories' '
test_create_repo 1f &&
(
cd 1f &&
test_create_repo 1f &&
(
cd 1f &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '1f-check: Split a directory into two other directories' '
+test_expect_success '1f: Split a directory into two other directories' '
+ test_setup_1f &&
# Commit A: y/b, w/c
# Commit B: z/{b,c,d}
# Expected: y/b, w/c, z/d, with warning about z/ -> (y/ vs. w/) conflict
# Commit A: y/b, w/c
# Commit B: z/{b,c,d}
# Expected: y/b, w/c, z/d, with warning about z/ -> (y/ vs. w/) conflict
-test_expect_success '2a-setup: Directory split into two on one side, with equal numbers of paths' '
test_create_repo 2a &&
(
cd 2a &&
test_create_repo 2a &&
(
cd 2a &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '2a-check: Directory split into two on one side, with equal numbers of paths' '
+test_expect_success '2a: Directory split into two on one side, with equal numbers of paths' '
+ test_setup_2a &&
# Commit A: y/b, w/c
# Commit B: z/{b,c}, x/d
# Expected: y/b, w/c, x/d; No warning about z/ -> (y/ vs. w/) conflict
# Commit A: y/b, w/c
# Commit B: z/{b,c}, x/d
# Expected: y/b, w/c, x/d; No warning about z/ -> (y/ vs. w/) conflict
-test_expect_success '2b-setup: Directory split into two on one side, with equal numbers of paths' '
test_create_repo 2b &&
(
cd 2b &&
test_create_repo 2b &&
(
cd 2b &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '2b-check: Directory split into two on one side, with equal numbers of paths' '
+test_expect_success '2b: Directory split into two on one side, with equal numbers of paths' '
+ test_setup_2b &&
# Commit A: z/{b,c,d} (no change)
# Commit B: y/{b,c}, x/d
# Expected: y/{b,c}, x/d
# Commit A: z/{b,c,d} (no change)
# Commit B: y/{b,c}, x/d
# Expected: y/{b,c}, x/d
-test_expect_success '3a-setup: Avoid implicit rename if involved as source on other side' '
test_create_repo 3a &&
(
cd 3a &&
test_create_repo 3a &&
(
cd 3a &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '3a-check: Avoid implicit rename if involved as source on other side' '
+test_expect_success '3a: Avoid implicit rename if involved as source on other side' '
+ test_setup_3a &&
# get it involved in directory rename detection. If it were, we might
# end up with CONFLICT:(z/d -> y/d vs. x/d vs. w/d), i.e. a
# rename/rename/rename(1to3) conflict, which is just weird.
# get it involved in directory rename detection. If it were, we might
# end up with CONFLICT:(z/d -> y/d vs. x/d vs. w/d), i.e. a
# rename/rename/rename(1to3) conflict, which is just weird.
-test_expect_success '3b-setup: Avoid implicit rename if involved as source on current side' '
test_create_repo 3b &&
(
cd 3b &&
test_create_repo 3b &&
(
cd 3b &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '3b-check: Avoid implicit rename if involved as source on current side' '
+test_expect_success '3b: Avoid implicit rename if involved as source on current side' '
+ test_setup_3b &&
# Expected: y/{b,c,d}, z/{e,f}
# NOTE: Even though most files from z moved to y, we don't want f to follow.
# Expected: y/{b,c,d}, z/{e,f}
# NOTE: Even though most files from z moved to y, we don't want f to follow.
-test_expect_success '4a-setup: Directory split, with original directory still present' '
test_create_repo 4a &&
(
cd 4a &&
test_create_repo 4a &&
(
cd 4a &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '4a-check: Directory split, with original directory still present' '
+test_expect_success '4a: Directory split, with original directory still present' '
+ test_setup_4a &&
# of history, giving us no way to represent this conflict in the
# index.
# of history, giving us no way to represent this conflict in the
# index.
-test_expect_success '5a-setup: Merge directories, other side adds files to original and target' '
test_create_repo 5a &&
(
cd 5a &&
test_create_repo 5a &&
(
cd 5a &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '5a-check: Merge directories, other side adds files to original and target' '
+test_expect_success '5a: Merge directories, other side adds files to original and target' '
+ test_setup_5a &&
# cause us to bail on directory rename detection for that path, falling
# back to git behavior without the directory rename detection.
# cause us to bail on directory rename detection for that path, falling
# back to git behavior without the directory rename detection.
-test_expect_success '5b-setup: Rename/delete in order to get add/add/add conflict' '
test_create_repo 5b &&
(
cd 5b &&
test_create_repo 5b &&
(
cd 5b &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '5b-check: Rename/delete in order to get add/add/add conflict' '
+test_expect_success '5b: Rename/delete in order to get add/add/add conflict' '
+ test_setup_5b &&
# y/d are y/d_2 and y/d_4. We still do the move from z/e to y/e,
# though, because it doesn't have anything in the way.
# y/d are y/d_2 and y/d_4. We still do the move from z/e to y/e,
# though, because it doesn't have anything in the way.
-test_expect_success '5c-setup: Transitive rename would cause rename/rename/rename/add/add/add' '
test_create_repo 5c &&
(
cd 5c &&
test_create_repo 5c &&
(
cd 5c &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '5c-check: Transitive rename would cause rename/rename/rename/add/add/add' '
+test_expect_success '5c: Transitive rename would cause rename/rename/rename/add/add/add' '
+ test_setup_5c &&
# detection for z/d_2, but that doesn't prevent us from applying the
# directory rename detection for z/f -> y/f.
# detection for z/d_2, but that doesn't prevent us from applying the
# directory rename detection for z/f -> y/f.
-test_expect_success '5d-setup: Directory/file/file conflict due to directory rename' '
test_create_repo 5d &&
(
cd 5d &&
test_create_repo 5d &&
(
cd 5d &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '5d-check: Directory/file/file conflict due to directory rename' '
+test_expect_success '5d: Directory/file/file conflict due to directory rename' '
+ test_setup_5d &&
# them under y/ doesn't accidentally catch z/d and make it look like
# it is also involved in a rename/delete conflict.
# them under y/ doesn't accidentally catch z/d and make it look like
# it is also involved in a rename/delete conflict.
-test_expect_success '6a-setup: Tricky rename/delete' '
test_create_repo 6a &&
(
cd 6a &&
test_create_repo 6a &&
(
cd 6a &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '6a-check: Tricky rename/delete' '
+test_expect_success '6a: Tricky rename/delete' '
+ test_setup_6a &&
# but B did that rename and still decided to put the file into z/,
# so we probably shouldn't apply directory rename detection for it.
# but B did that rename and still decided to put the file into z/,
# so we probably shouldn't apply directory rename detection for it.
-test_expect_success '6b-setup: Same rename done on both sides' '
test_create_repo 6b &&
(
cd 6b &&
test_create_repo 6b &&
(
cd 6b &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '6b-check: Same rename done on both sides' '
+test_expect_success '6b: Same rename done on both sides' '
+ test_setup_6b &&
# NOTE: Seems obvious, but just checking that the implementation doesn't
# "accidentally detect a rename" and give us y/{b,c,d}.
# NOTE: Seems obvious, but just checking that the implementation doesn't
# "accidentally detect a rename" and give us y/{b,c,d}.
-test_expect_success '6c-setup: Rename only done on same side' '
test_create_repo 6c &&
(
cd 6c &&
test_create_repo 6c &&
(
cd 6c &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '6c-check: Rename only done on same side' '
+test_expect_success '6c: Rename only done on same side' '
+ test_setup_6c &&
# NOTE: Again, this seems obvious but just checking that the implementation
# doesn't "accidentally detect a rename" and give us y/{b,c,d}.
# NOTE: Again, this seems obvious but just checking that the implementation
# doesn't "accidentally detect a rename" and give us y/{b,c,d}.
-test_expect_success '6d-setup: We do not always want transitive renaming' '
test_create_repo 6d &&
(
cd 6d &&
test_create_repo 6d &&
(
cd 6d &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '6d-check: We do not always want transitive renaming' '
+test_expect_success '6d: We do not always want transitive renaming' '
+ test_setup_6d &&
# doesn't "accidentally detect a rename" and give us y/{b,c} +
# add/add conflict on y/d_1 vs y/d_2.
# doesn't "accidentally detect a rename" and give us y/{b,c} +
# add/add conflict on y/d_1 vs y/d_2.
-test_expect_success '6e-setup: Add/add from one side' '
test_create_repo 6e &&
(
cd 6e &&
test_create_repo 6e &&
(
cd 6e &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '6e-check: Add/add from one side' '
+test_expect_success '6e: Add/add from one side' '
+ test_setup_6e &&
# Expected: y/d, CONFLICT(rename/rename for both z/b and z/c)
# NOTE: There's a rename of z/ here, y/ has more renames, so z/d -> y/d.
# Expected: y/d, CONFLICT(rename/rename for both z/b and z/c)
# NOTE: There's a rename of z/ here, y/ has more renames, so z/d -> y/d.
-test_expect_success '7a-setup: rename-dir vs. rename-dir (NOT split evenly) PLUS add-other-file' '
test_create_repo 7a &&
(
cd 7a &&
test_create_repo 7a &&
(
cd 7a &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '7a-check: rename-dir vs. rename-dir (NOT split evenly) PLUS add-other-file' '
+test_expect_success '7a: rename-dir vs. rename-dir (NOT split evenly) PLUS add-other-file' '
+ test_setup_7a &&
# Commit B: z/{b,c,d_1}, w/d_2
# Expected: y/{b,c}, CONFLICT(rename/rename(2to1): x/d_1, w/d_2 -> y_d)
# Commit B: z/{b,c,d_1}, w/d_2
# Expected: y/{b,c}, CONFLICT(rename/rename(2to1): x/d_1, w/d_2 -> y_d)
-test_expect_success '7b-setup: rename/rename(2to1), but only due to transitive rename' '
test_create_repo 7b &&
(
cd 7b &&
test_create_repo 7b &&
(
cd 7b &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '7b-check: rename/rename(2to1), but only due to transitive rename' '
+test_expect_success '7b: rename/rename(2to1), but only due to transitive rename' '
+ test_setup_7b &&
# neither CONFLICT(x/d -> w/d vs. z/d)
# nor CONFLiCT x/d -> w/d vs. y/d vs. z/d)
# neither CONFLICT(x/d -> w/d vs. z/d)
# nor CONFLiCT x/d -> w/d vs. y/d vs. z/d)
-test_expect_success '7c-setup: rename/rename(1to...2or3); transitive rename may add complexity' '
test_create_repo 7c &&
(
cd 7c &&
test_create_repo 7c &&
(
cd 7c &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '7c-check: rename/rename(1to...2or3); transitive rename may add complexity' '
+test_expect_success '7c: rename/rename(1to...2or3); transitive rename may add complexity' '
+ test_setup_7c &&
# Expected: y/{b,c}, CONFLICT(delete x/d vs rename to y/d)
# NOTE: z->y so NOT CONFLICT(delete x/d vs rename to z/d)
# Expected: y/{b,c}, CONFLICT(delete x/d vs rename to y/d)
# NOTE: z->y so NOT CONFLICT(delete x/d vs rename to z/d)
-test_expect_success '7d-setup: transitive rename involved in rename/delete; how is it reported?' '
test_create_repo 7d &&
(
cd 7d &&
test_create_repo 7d &&
(
cd 7d &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '7d-check: transitive rename involved in rename/delete; how is it reported?' '
+test_expect_success '7d: transitive rename involved in rename/delete; how is it reported?' '
+ test_setup_7d &&
# see testcases 9c and 9d for further discussion of this issue and
# how it's resolved.
# see testcases 9c and 9d for further discussion of this issue and
# how it's resolved.
-test_expect_success '7e-setup: transitive rename in rename/delete AND dirs in the way' '
test_create_repo 7e &&
(
cd 7e &&
test_create_repo 7e &&
(
cd 7e &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '7e-check: transitive rename in rename/delete AND dirs in the way' '
+test_expect_success '7e: transitive rename in rename/delete AND dirs in the way' '
+ test_setup_7e &&
# simple rule from section 5 prevents me from handling this as optimally as
# we potentially could.
# simple rule from section 5 prevents me from handling this as optimally as
# we potentially could.
-test_expect_success '8a-setup: Dual-directory rename, one into the others way' '
test_create_repo 8a &&
(
cd 8a &&
test_create_repo 8a &&
(
cd 8a &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '8a-check: Dual-directory rename, one into the others way' '
+test_expect_success '8a: Dual-directory rename, one into the others way' '
+ test_setup_8a &&
# making us fall back to pre-directory-rename-detection behavior for both
# e_1 and e_2.
# making us fall back to pre-directory-rename-detection behavior for both
# e_1 and e_2.
-test_expect_success '8b-setup: Dual-directory rename, one into the others way, with conflicting filenames' '
test_create_repo 8b &&
(
cd 8b &&
test_create_repo 8b &&
(
cd 8b &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '8b-check: Dual-directory rename, one into the others way, with conflicting filenames' '
+test_expect_success '8b: Dual-directory rename, one into the others way, with conflicting filenames' '
+ test_setup_8b &&
# rename/rename(1to2) conflicts -- see testcase 9h. See also
# notes in 8d.
# rename/rename(1to2) conflicts -- see testcase 9h. See also
# notes in 8d.
-test_expect_success '8c-setup: modify/delete or rename+modify/delete?' '
test_create_repo 8c &&
(
cd 8c &&
test_create_repo 8c &&
(
cd 8c &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '8c-check: modify/delete or rename+modify/delete' '
+test_expect_success '8c: modify/delete or rename+modify/delete' '
+ test_setup_8c &&
# during merging are supposed to be about opposite sides doing things
# differently.
# during merging are supposed to be about opposite sides doing things
# differently.
-test_expect_success '8d-setup: rename/delete...or not?' '
test_create_repo 8d &&
(
cd 8d &&
test_create_repo 8d &&
(
cd 8d &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '8d-check: rename/delete...or not?' '
+test_expect_success '8d: rename/delete...or not?' '
+ test_setup_8d &&
# about the ramifications of doing that, I didn't know how to rule out
# that opening other weird edge and corner cases so I just punted.
# about the ramifications of doing that, I didn't know how to rule out
# that opening other weird edge and corner cases so I just punted.
-test_expect_success '8e-setup: Both sides rename, one side adds to original directory' '
test_create_repo 8e &&
(
cd 8e &&
test_create_repo 8e &&
(
cd 8e &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '8e-check: Both sides rename, one side adds to original directory' '
+test_expect_success '8e: Both sides rename, one side adds to original directory' '
+ test_setup_8e &&
# of which one had the most paths going to it. A naive implementation
# of that could take the new file in commit B at z/i to x/w/i or x/i.
# of which one had the most paths going to it. A naive implementation
# of that could take the new file in commit B at z/i to x/w/i or x/i.
-test_expect_success '9a-setup: Inner renamed directory within outer renamed directory' '
test_create_repo 9a &&
(
cd 9a &&
test_create_repo 9a &&
(
cd 9a &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '9a-check: Inner renamed directory within outer renamed directory' '
+test_expect_success '9a: Inner renamed directory within outer renamed directory' '
+ test_setup_9a &&
# Commit B: z/{b,c,d_3}
# Expected: y/{b,c,d_merged}
# Commit B: z/{b,c,d_3}
# Expected: y/{b,c,d_merged}
-test_expect_success '9b-setup: Transitive rename with content merge' '
test_create_repo 9b &&
(
cd 9b &&
test_create_repo 9b &&
(
cd 9b &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '9b-check: Transitive rename with content merge' '
+test_expect_success '9b: Transitive rename with content merge' '
+ test_setup_9b &&
# away, then ignore that particular rename from the other side of
# history for any implicit directory renames.
# away, then ignore that particular rename from the other side of
# history for any implicit directory renames.
-test_expect_success '9c-setup: Doubly transitive rename?' '
test_create_repo 9c &&
(
cd 9c &&
test_create_repo 9c &&
(
cd 9c &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '9c-check: Doubly transitive rename?' '
+test_expect_success '9c: Doubly transitive rename?' '
+ test_setup_9c &&
# simple rules that are consistent with what we need for all the other
# testcases and simplifies things for the user.
# simple rules that are consistent with what we need for all the other
# testcases and simplifies things for the user.
-test_expect_success '9d-setup: N-way transitive rename?' '
test_create_repo 9d &&
(
cd 9d &&
test_create_repo 9d &&
(
cd 9d &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '9d-check: N-way transitive rename?' '
+test_expect_success '9d: N-way transitive rename?' '
+ test_setup_9d &&
# Expected: combined/{a,b,c,d,e,f,g,h,i,j,k,l}, CONFLICT(Nto1) warnings,
# dir1/yo, dir2/yo, dir3/yo, dirN/yo
# Expected: combined/{a,b,c,d,e,f,g,h,i,j,k,l}, CONFLICT(Nto1) warnings,
# dir1/yo, dir2/yo, dir3/yo, dirN/yo
-test_expect_success '9e-setup: N-to-1 whammo' '
test_create_repo 9e &&
(
cd 9e &&
test_create_repo 9e &&
(
cd 9e &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success C_LOCALE_OUTPUT '9e-check: N-to-1 whammo' '
+test_expect_success C_LOCALE_OUTPUT '9e: N-to-1 whammo' '
+ test_setup_9e &&
# Commit B: goal/{a,b}/$more_files, goal/c
# Expected: priority/{a,b}/$more_files, priority/c
# Commit B: goal/{a,b}/$more_files, goal/c
# Expected: priority/{a,b}/$more_files, priority/c
-test_expect_success '9f-setup: Renamed directory that only contained immediate subdirs' '
test_create_repo 9f &&
(
cd 9f &&
test_create_repo 9f &&
(
cd 9f &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '9f-check: Renamed directory that only contained immediate subdirs' '
+test_expect_success '9f: Renamed directory that only contained immediate subdirs' '
+ test_setup_9f &&
# Commit B: goal/{a,b}/$more_files, goal/c
# Expected: priority/{alpha,bravo}/$more_files, priority/c
# Commit B: goal/{a,b}/$more_files, goal/c
# Expected: priority/{alpha,bravo}/$more_files, priority/c
-test_expect_success '9g-setup: Renamed directory that only contained immediate subdirs, immediate subdirs renamed' '
test_create_repo 9g &&
(
cd 9g &&
test_create_repo 9g &&
(
cd 9g &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_failure '9g-check: Renamed directory that only contained immediate subdirs, immediate subdirs renamed' '
+test_expect_failure '9g: Renamed directory that only contained immediate subdirs, immediate subdirs renamed' '
# Expected: y/{b,c}, x/d_2
# NOTE: If we applied the z/ -> y/ rename to z/d, then we'd end up with
# a rename/rename(1to2) conflict (z/d -> y/d vs. x/d)
# Expected: y/{b,c}, x/d_2
# NOTE: If we applied the z/ -> y/ rename to z/d, then we'd end up with
# a rename/rename(1to2) conflict (z/d -> y/d vs. x/d)
-test_expect_success '9h-setup: Avoid dir rename on merely modified path' '
test_create_repo 9h &&
(
cd 9h &&
test_create_repo 9h &&
(
cd 9h &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '9h-check: Avoid dir rename on merely modified path' '
+test_expect_success '9h: Avoid dir rename on merely modified path' '
+ test_setup_9h &&
# Expected: Aborted Merge +
# ERROR_MSG(untracked working tree files would be overwritten by merge)
# Expected: Aborted Merge +
# ERROR_MSG(untracked working tree files would be overwritten by merge)
-test_expect_success '10a-setup: Overwrite untracked with normal rename/delete' '
test_create_repo 10a &&
(
cd 10a &&
test_create_repo 10a &&
(
cd 10a &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '10a-check: Overwrite untracked with normal rename/delete' '
+test_expect_success '10a: Overwrite untracked with normal rename/delete' '
+ test_setup_10a &&
# z/c_1 -> z/d_1 rename recorded at stage 3 for y/d +
# ERROR_MSG(refusing to lose untracked file at 'y/d')
# z/c_1 -> z/d_1 rename recorded at stage 3 for y/d +
# ERROR_MSG(refusing to lose untracked file at 'y/d')
-test_expect_success '10b-setup: Overwrite untracked with dir rename + delete' '
test_create_repo 10b &&
(
cd 10b &&
test_create_repo 10b &&
(
cd 10b &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '10b-check: Overwrite untracked with dir rename + delete' '
+test_expect_success '10b: Overwrite untracked with dir rename + delete' '
+ test_setup_10b &&
# y/c~B^0 +
# ERROR_MSG(Refusing to lose untracked file at y/c)
# y/c~B^0 +
# ERROR_MSG(Refusing to lose untracked file at y/c)
-test_expect_success '10c-setup: Overwrite untracked with dir rename/rename(1to2)' '
- test_create_repo 10c &&
+test_setup_10c () {
+ test_create_repo 10c_$1 &&
mkdir z x &&
echo a >z/a &&
mkdir z x &&
echo a >z/a &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '10c-check: Overwrite untracked with dir rename/rename(1to2)' '
+test_expect_success '10c1: Overwrite untracked with dir rename/rename(1to2)' '
+ test_setup_10c 1 &&
git checkout A^0 &&
echo important >y/c &&
git checkout A^0 &&
echo important >y/c &&
-test_expect_success '10c-check: Overwrite untracked with dir rename/rename(1to2), other direction' '
+test_expect_success '10c2: Overwrite untracked with dir rename/rename(1to2), other direction' '
+ test_setup_10c 2 &&
git reset --hard &&
git clean -fdqx &&
git reset --hard &&
git clean -fdqx &&
# CONFLICT(rename/rename) z/c_1 vs x/f_2 -> y/wham
# ERROR_MSG(Refusing to lose untracked file at y/wham)
# CONFLICT(rename/rename) z/c_1 vs x/f_2 -> y/wham
# ERROR_MSG(Refusing to lose untracked file at y/wham)
-test_expect_success '10d-setup: Delete untracked with dir rename/rename(2to1)' '
test_create_repo 10d &&
(
cd 10d &&
test_create_repo 10d &&
(
cd 10d &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '10d-check: Delete untracked with dir rename/rename(2to1)' '
+test_expect_success '10d: Delete untracked with dir rename/rename(2to1)' '
+ test_setup_10d &&
# Commit B: z/{a,b,c}
# Expected: y/{a,b,c} + untracked z/c
# Commit B: z/{a,b,c}
# Expected: y/{a,b,c} + untracked z/c
-test_expect_success '10e-setup: Does git complain about untracked file that is not really in the way?' '
test_create_repo 10e &&
(
cd 10e &&
test_create_repo 10e &&
(
cd 10e &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_failure '10e-check: Does git complain about untracked file that is not really in the way?' '
+test_expect_failure '10e: Does git complain about untracked file that is not really in the way?' '
# z/c~HEAD with contents of B:z/b_v2,
# z/c with uncommitted mods on top of A:z/c_v1
# z/c~HEAD with contents of B:z/b_v2,
# z/c with uncommitted mods on top of A:z/c_v1
-test_expect_success '11a-setup: Avoid losing dirty contents with simple rename' '
test_create_repo 11a &&
(
cd 11a &&
test_create_repo 11a &&
(
cd 11a &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '11a-check: Avoid losing dirty contents with simple rename' '
+test_expect_success '11a: Avoid losing dirty contents with simple rename' '
+ test_setup_11a &&
# ERROR_MSG(Refusing to lose dirty file at z/c)
# ERROR_MSG(Refusing to lose dirty file at z/c)
-test_expect_success '11b-setup: Avoid losing dirty file involved in directory rename' '
test_create_repo 11b &&
(
cd 11b &&
test_create_repo 11b &&
(
cd 11b &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '11b-check: Avoid losing dirty file involved in directory rename' '
+test_expect_success '11b: Avoid losing dirty file involved in directory rename' '
+ test_setup_11b &&
# Expected: Abort_msg("following files would be overwritten by merge") +
# y/c left untouched (still has uncommitted mods)
# Expected: Abort_msg("following files would be overwritten by merge") +
# y/c left untouched (still has uncommitted mods)
-test_expect_success '11c-setup: Avoid losing not-uptodate with rename + D/F conflict' '
test_create_repo 11c &&
(
cd 11c &&
test_create_repo 11c &&
(
cd 11c &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '11c-check: Avoid losing not-uptodate with rename + D/F conflict' '
+test_expect_success '11c: Avoid losing not-uptodate with rename + D/F conflict' '
+ test_setup_11c &&
# Warning_Msg("Refusing to lose dirty file at z/c) +
# y/{a,c~HEAD,c/d}, x/b, now-untracked z/c_v1 with uncommitted mods
# Warning_Msg("Refusing to lose dirty file at z/c) +
# y/{a,c~HEAD,c/d}, x/b, now-untracked z/c_v1 with uncommitted mods
-test_expect_success '11d-setup: Avoid losing not-uptodate with rename + D/F conflict' '
test_create_repo 11d &&
(
cd 11d &&
test_create_repo 11d &&
(
cd 11d &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '11d-check: Avoid losing not-uptodate with rename + D/F conflict' '
+test_expect_success '11d: Avoid losing not-uptodate with rename + D/F conflict' '
+ test_setup_11d &&
# y/c~HEAD has A:y/c_2 contents
# y/c has dirty file from before merge
# y/c~HEAD has A:y/c_2 contents
# y/c has dirty file from before merge
-test_expect_success '11e-setup: Avoid deleting not-uptodate with dir rename/rename(1to2)/add' '
test_create_repo 11e &&
(
cd 11e &&
test_create_repo 11e &&
(
cd 11e &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '11e-check: Avoid deleting not-uptodate with dir rename/rename(1to2)/add' '
+test_expect_success '11e: Avoid deleting not-uptodate with dir rename/rename(1to2)/add' '
+ test_setup_11e &&
# CONFLICT(rename/rename) x/c vs x/d -> y/wham
# ERROR_MSG(Refusing to lose dirty file at y/wham)
# CONFLICT(rename/rename) x/c vs x/d -> y/wham
# ERROR_MSG(Refusing to lose dirty file at y/wham)
-test_expect_success '11f-setup: Avoid deleting not-uptodate with dir rename/rename(2to1)' '
test_create_repo 11f &&
(
cd 11f &&
test_create_repo 11f &&
(
cd 11f &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '11f-check: Avoid deleting not-uptodate with dir rename/rename(2to1)' '
+test_expect_success '11f: Avoid deleting not-uptodate with dir rename/rename(2to1)' '
+ test_setup_11f &&
# Commit B: node1/{leaf1,leaf2,leaf5}, node2/{leaf3,leaf4,leaf6}
# Expected: node1/{leaf1,leaf2,leaf5,node2/{leaf3,leaf4,leaf6}}
# Commit B: node1/{leaf1,leaf2,leaf5}, node2/{leaf3,leaf4,leaf6}
# Expected: node1/{leaf1,leaf2,leaf5,node2/{leaf3,leaf4,leaf6}}
-test_expect_success '12a-setup: Moving one directory hierarchy into another' '
test_create_repo 12a &&
(
cd 12a &&
test_create_repo 12a &&
(
cd 12a &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '12a-check: Moving one directory hierarchy into another' '
+test_expect_success '12a: Moving one directory hierarchy into another' '
+ test_setup_12a &&
# To which, I can do no more than shrug my shoulders and say that
# even simple rules give weird results when given weird inputs.
# To which, I can do no more than shrug my shoulders and say that
# even simple rules give weird results when given weird inputs.
-test_expect_success '12b-setup: Moving two directory hierarchies into each other' '
test_create_repo 12b &&
(
cd 12b &&
test_create_repo 12b &&
(
cd 12b &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '12b-check: Moving two directory hierarchies into each other' '
+test_expect_success '12b: Moving two directory hierarchies into each other' '
+ test_setup_12b &&
# NOTE: This is *exactly* like 12c, except that every path is modified on
# each side of the merge.
# NOTE: This is *exactly* like 12c, except that every path is modified on
# each side of the merge.
-test_expect_success '12c-setup: Moving one directory hierarchy into another w/ content merge' '
test_create_repo 12c &&
(
cd 12c &&
test_create_repo 12c &&
(
cd 12c &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '12c-check: Moving one directory hierarchy into another w/ content merge' '
+test_expect_success '12c: Moving one directory hierarchy into another w/ content merge' '
+ test_setup_12c &&
# Commit B: a/b/subdir/foo, a/b/bar
# Expected: subdir/foo, bar
# Commit B: a/b/subdir/foo, a/b/bar
# Expected: subdir/foo, bar
-test_expect_success '12d-setup: Rename/merge subdir into the root, variant 1' '
test_create_repo 12d &&
(
cd 12d &&
test_create_repo 12d &&
(
cd 12d &&
git checkout B &&
test_commit a/b/bar
)
git checkout B &&
test_commit a/b/bar
)
-test_expect_success '12d-check: Rename/merge subdir into the root, variant 1' '
+test_expect_success '12d: Rename/merge subdir into the root, variant 1' '
+ test_setup_12d &&
# Commit B: a/b/foo, a/b/bar
# Expected: foo, bar
# Commit B: a/b/foo, a/b/bar
# Expected: foo, bar
-test_expect_success '12e-setup: Rename/merge subdir into the root, variant 2' '
test_create_repo 12e &&
(
cd 12e &&
test_create_repo 12e &&
(
cd 12e &&
git checkout B &&
test_commit a/b/bar
)
git checkout B &&
test_commit a/b/bar
)
-test_expect_success '12e-check: Rename/merge subdir into the root, variant 2' '
+test_expect_success '12e: Rename/merge subdir into the root, variant 2' '
+ test_setup_12e &&
# Commit B: z/{b,c,d,e/f}
# Expected: y/{b,c,d,e/f}, with notices/conflicts for both y/d and y/e/f
# Commit B: z/{b,c,d,e/f}
# Expected: y/{b,c,d,e/f}, with notices/conflicts for both y/d and y/e/f
-test_expect_success '13a-setup: messages for newly added files' '
- test_create_repo 13a &&
+test_setup_13a () {
+ test_create_repo 13a_$1 &&
mkdir z &&
echo b >z/b &&
mkdir z &&
echo b >z/b &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '13a-check(conflict): messages for newly added files' '
+test_expect_success '13a(conflict): messages for newly added files' '
+ test_setup_13a conflict &&
-test_expect_success '13a-check(info): messages for newly added files' '
+test_expect_success '13a(info): messages for newly added files' '
+ test_setup_13a info &&
git reset --hard &&
git checkout A^0 &&
git reset --hard &&
git checkout A^0 &&
# Expected: y/{b,c,d_merged}, with two conflict messages for y/d,
# one about content, and one about file location
# Expected: y/{b,c,d_merged}, with two conflict messages for y/d,
# one about content, and one about file location
-test_expect_success '13b-setup: messages for transitive rename with conflicted content' '
- test_create_repo 13b &&
+test_setup_13b () {
+ test_create_repo 13b_$1 &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '13b-check(conflict): messages for transitive rename with conflicted content' '
+test_expect_success '13b(conflict): messages for transitive rename with conflicted content' '
+ test_setup_13b conflict &&
-test_expect_success '13b-check(info): messages for transitive rename with conflicted content' '
+test_expect_success '13b(info): messages for transitive rename with conflicted content' '
+ test_setup_13b info &&
git reset --hard &&
git checkout A^0 &&
git reset --hard &&
git checkout A^0 &&
# d and B had full knowledge, but that's a slippery slope as
# shown in testcase 13d.
# d and B had full knowledge, but that's a slippery slope as
# shown in testcase 13d.
-test_expect_success '13c-setup: messages for rename/rename(1to1) via transitive rename' '
- test_create_repo 13c &&
+test_setup_13c () {
+ test_create_repo 13c_$1 &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '13c-check(conflict): messages for rename/rename(1to1) via transitive rename' '
+test_expect_success '13c(conflict): messages for rename/rename(1to1) via transitive rename' '
+ test_setup_13c conflict &&
-test_expect_success '13c-check(info): messages for rename/rename(1to1) via transitive rename' '
+test_expect_success '13c(info): messages for rename/rename(1to1) via transitive rename' '
+ test_setup_13c info &&
git reset --hard &&
git checkout A^0 &&
git reset --hard &&
git checkout A^0 &&
# * B renames a/y to c/y, and A renames c/->d/ => a/y -> d/y
# No conflict in where a/y ends up, so put it in d/y.
# * B renames a/y to c/y, and A renames c/->d/ => a/y -> d/y
# No conflict in where a/y ends up, so put it in d/y.
-test_expect_success '13d-setup: messages for rename/rename(1to1) via dual transitive rename' '
- test_create_repo 13d &&
+test_setup_13d () {
+ test_create_repo 13d_$1 &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '13d-check(conflict): messages for rename/rename(1to1) via dual transitive rename' '
+test_expect_success '13d(conflict): messages for rename/rename(1to1) via dual transitive rename' '
+ test_setup_13d conflict &&
-test_expect_success '13d-check(info): messages for rename/rename(1to1) via dual transitive rename' '
+test_expect_success '13d(info): messages for rename/rename(1to1) via dual transitive rename' '
+ test_setup_13d info &&
git reset --hard &&
git checkout A^0 &&
git reset --hard &&
git checkout A^0 &&
# in the outer merge for this special kind of setup, but it at
# least avoids hitting a BUG().
#
# in the outer merge for this special kind of setup, but it at
# least avoids hitting a BUG().
#
-test_expect_success '13e-setup: directory rename detection in recursive case' '
test_create_repo 13e &&
(
cd 13e &&
test_create_repo 13e &&
(
cd 13e &&
test_tick &&
git commit -m "D"
)
test_tick &&
git commit -m "D"
)
-test_expect_success '13e-check: directory rename detection in recursive case' '
+test_expect_success '13e: directory rename detection in recursive case' '
+ test_setup_13e &&
# Commit B: b_3
# Expected: b_2
# Commit B: b_3
# Expected: b_2
-test_expect_success '1a-setup: Modify(A)/Modify(B), change on B subset of A' '
- test_create_repo 1a &&
+test_setup_1a () {
+ test_create_repo 1a_$1 &&
test_write_lines 1 2 3 4 5 6 7 8 9 10 >b &&
git add b &&
test_write_lines 1 2 3 4 5 6 7 8 9 10 >b &&
git add b &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '1a-check-L: Modify(A)/Modify(B), change on B subset of A' '
- test_when_finished "git -C 1a reset --hard" &&
- test_when_finished "git -C 1a clean -fd" &&
+test_expect_success '1a-L: Modify(A)/Modify(B), change on B subset of A' '
+ test_setup_1a L &&
-test_expect_success '1a-check-R: Modify(A)/Modify(B), change on B subset of A' '
- test_when_finished "git -C 1a reset --hard" &&
- test_when_finished "git -C 1a clean -fd" &&
+test_expect_success '1a-R: Modify(A)/Modify(B), change on B subset of A' '
+ test_setup_1a R &&
# Commit B: c_1
# Expected: c_2
# Commit B: c_1
# Expected: c_2
-test_expect_success '2a-setup: Modify(A)/rename(B)' '
- test_create_repo 2a &&
+test_setup_2a () {
+ test_create_repo 2a_$1 &&
test_seq 1 10 >b &&
git add b &&
test_seq 1 10 >b &&
git add b &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '2a-check-L: Modify/rename, merge into modify side' '
- test_when_finished "git -C 2a reset --hard" &&
- test_when_finished "git -C 2a clean -fd" &&
+test_expect_success '2a-L: Modify/rename, merge into modify side' '
+ test_setup_2a L &&
-test_expect_success '2a-check-R: Modify/rename, merge into rename side' '
- test_when_finished "git -C 2a reset --hard" &&
- test_when_finished "git -C 2a clean -fd" &&
+test_expect_success '2a-R: Modify/rename, merge into rename side' '
+ test_setup_2a R &&
# Commit B: b_3
# Expected: c_2
# Commit B: b_3
# Expected: c_2
-test_expect_success '2b-setup: Rename+Mod(A)/Mod(B), B mods subset of A' '
- test_create_repo 2b &&
+test_setup_2b () {
+ test_create_repo 2b_$1 &&
test_write_lines 1 2 3 4 5 6 7 8 9 10 >b &&
git add b &&
test_write_lines 1 2 3 4 5 6 7 8 9 10 >b &&
git add b &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '2b-check-L: Rename+Mod(A)/Mod(B), B mods subset of A' '
- test_when_finished "git -C 2b reset --hard" &&
- test_when_finished "git -C 2b clean -fd" &&
+test_expect_success '2b-L: Rename+Mod(A)/Mod(B), B mods subset of A' '
+ test_setup_2b L &&
-test_expect_success '2b-check-R: Rename+Mod(A)/Mod(B), B mods subset of A' '
- test_when_finished "git -C 2b reset --hard" &&
- test_when_finished "git -C 2b clean -fd" &&
+test_expect_success '2b-R: Rename+Mod(A)/Mod(B), B mods subset of A' '
+ test_setup_2b R &&
# skip the update, then we're in trouble. This test verifies we do
# not make that particular mistake.
# skip the update, then we're in trouble. This test verifies we do
# not make that particular mistake.
-test_expect_success '2c-setup: Modify b & add c VS rename b->c' '
test_create_repo 2c &&
(
cd 2c &&
test_create_repo 2c &&
(
cd 2c &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '2c-check: Modify b & add c VS rename b->c' '
+test_expect_success '2c: Modify b & add c VS rename b->c' '
+ test_setup_2c &&
# Commit B: bq_1, bar/whatever
# Expected: bar/{bq_2, whatever}
# Commit B: bq_1, bar/whatever
# Expected: bar/{bq_2, whatever}
-test_expect_success '3a-setup: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
- test_create_repo 3a &&
+test_setup_3a () {
+ test_create_repo 3a_$1 &&
mkdir foo &&
test_seq 1 10 >bq &&
mkdir foo &&
test_seq 1 10 >bq &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '3a-check-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
- test_when_finished "git -C 3a reset --hard" &&
- test_when_finished "git -C 3a clean -fd" &&
+test_expect_success '3a-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
+ test_setup_3a L &&
-test_expect_success '3a-check-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
- test_when_finished "git -C 3a reset --hard" &&
- test_when_finished "git -C 3a clean -fd" &&
+test_expect_success '3a-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
+ test_setup_3a R &&
# Commit B: bq_2, bar/whatever
# Expected: bar/{bq_2, whatever}
# Commit B: bq_2, bar/whatever
# Expected: bar/{bq_2, whatever}
-test_expect_success '3b-setup: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
- test_create_repo 3b &&
+test_setup_3b () {
+ test_create_repo 3b_$1 &&
mkdir foo &&
test_seq 1 10 >bq &&
mkdir foo &&
test_seq 1 10 >bq &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '3b-check-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
- test_when_finished "git -C 3b reset --hard" &&
- test_when_finished "git -C 3b clean -fd" &&
+test_expect_success '3b-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
+ test_setup_3b L &&
-test_expect_success '3b-check-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
- test_when_finished "git -C 3b reset --hard" &&
- test_when_finished "git -C 3b clean -fd" &&
+test_expect_success '3b-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
+ test_setup_3b R &&
# Working copy: b_4
# Expected: b_2 for merge, b_4 in working copy
# Working copy: b_4
# Expected: b_2 for merge, b_4 in working copy
-test_expect_success '4a-setup: Change on A, change on B subset of A, dirty mods present' '
test_create_repo 4a &&
(
cd 4a &&
test_create_repo 4a &&
(
cd 4a &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
# NOTE: For as long as we continue using unpack_trees() without index_only
# set to true, it will error out on a case like this claiming the the locally
# NOTE: For as long as we continue using unpack_trees() without index_only
# set to true, it will error out on a case like this claiming the the locally
# correct requires doing the merge in-memory first, then realizing that no
# updates to the file are necessary, and thus that we can just leave the path
# alone.
# correct requires doing the merge in-memory first, then realizing that no
# updates to the file are necessary, and thus that we can just leave the path
# alone.
-test_expect_failure '4a-check: Change on A, change on B subset of A, dirty mods present' '
- test_when_finished "git -C 4a reset --hard" &&
- test_when_finished "git -C 4a clean -fd" &&
+test_expect_failure '4a: Change on A, change on B subset of A, dirty mods present' '
+ test_setup_4a &&
# Working copy: c_4
# Expected: c_2
# Working copy: c_4
# Expected: c_2
-test_expect_success '4b-setup: Rename+Mod(A)/Mod(B), change on B subset of A, dirty mods present' '
test_create_repo 4b &&
(
cd 4b &&
test_create_repo 4b &&
(
cd 4b &&
test_tick &&
git commit -m "B"
)
test_tick &&
git commit -m "B"
)
-test_expect_success '4b-check: Rename+Mod(A)/Mod(B), change on B subset of A, dirty mods present' '
- test_when_finished "git -C 4b reset --hard" &&
- test_when_finished "git -C 4b clean -fd" &&
+test_expect_success '4b: Rename+Mod(A)/Mod(B), change on B subset of A, dirty mods present' '
+ test_setup_4b &&