Browse Source

t604[236]: do not run setup in separate tests

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>
maint
Elijah Newren 5 years ago committed by Junio C Hamano
parent
commit
da1e295e00
  1. 111
      t/t6042-merge-rename-corner-cases.sh
  2. 466
      t/t6043-merge-rename-directories.sh
  3. 135
      t/t6046-merge-skip-unneeded-updates.sh

111
t/t6042-merge-rename-corner-cases.sh

@ -5,7 +5,7 @@ test_description="recursive merge corner cases w/ renames but not criss-crosses" @@ -5,7 +5,7 @@ test_description="recursive merge corner cases w/ renames but not criss-crosses"

. ./test-lib.sh

test_expect_success 'setup rename/delete + untracked file' '
test_setup_rename_delete_untracked () {
test_create_repo rename-delete-untracked &&
(
cd rename-delete-untracked &&
@ -29,9 +29,10 @@ test_expect_success 'setup rename/delete + untracked file' ' @@ -29,9 +29,10 @@ test_expect_success 'setup rename/delete + untracked file' '
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 &&

@ -49,7 +50,7 @@ test_expect_success "Does git preserve Gollum's precious artifact?" ' @@ -49,7 +50,7 @@ test_expect_success "Does git preserve Gollum's precious artifact?" '
#
# 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 &&
@ -70,9 +71,10 @@ test_expect_success 'setup rename/modify/add-source conflict' ' @@ -70,9 +71,10 @@ test_expect_success 'setup rename/modify/add-source conflict' '
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 &&

@ -88,7 +90,7 @@ test_expect_failure 'rename/modify/add-source conflict resolvable' ' @@ -88,7 +90,7 @@ test_expect_failure 'rename/modify/add-source conflict resolvable' '
)
'

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 &&
@ -110,9 +112,10 @@ test_expect_success 'setup resolvable conflict missed if rename missed' ' @@ -110,9 +112,10 @@ test_expect_success 'setup resolvable conflict missed if rename missed' '
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 &&

@ -135,7 +138,7 @@ test_expect_failure 'conflict caused if rename not detected' ' @@ -135,7 +138,7 @@ test_expect_failure 'conflict caused if rename not detected' '
)
'

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 &&
@ -160,9 +163,10 @@ test_expect_success 'setup conflict resolved wrong if rename missed' ' @@ -160,9 +163,10 @@ test_expect_success 'setup conflict resolved wrong if rename missed' '
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 &&

@ -182,7 +186,7 @@ test_expect_failure 'missed conflict if rename not detected' ' @@ -182,7 +186,7 @@ test_expect_failure 'missed conflict if rename not detected' '
# 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 &&
@ -202,9 +206,10 @@ test_expect_success 'setup undetected rename/add-source causes data loss' ' @@ -202,9 +206,10 @@ test_expect_success 'setup undetected rename/add-source causes data loss' '
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 &&

@ -231,6 +236,7 @@ test_expect_failure 'detect rename/add-source and preserve all data' ' @@ -231,6 +236,7 @@ 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 &&

@ -256,10 +262,10 @@ test_expect_failure 'detect rename/add-source and preserve all data, merge other @@ -256,10 +262,10 @@ test_expect_failure 'detect rename/add-source and preserve all data, merge other
)
'

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 &&
@ -290,11 +296,12 @@ test_expect_success 'setup content merge + rename/directory conflict' ' @@ -290,11 +296,12 @@ test_expect_success 'setup content merge + rename/directory conflict' '
test_tick &&
git commit -m left
)
'
}

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 &&

@ -320,8 +327,9 @@ test_expect_success 'rename/directory conflict + clean content merge' ' @@ -320,8 +327,9 @@ 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-1 &&
cd rename-directory-1b &&

git reset --hard &&
git clean -fdqx &&
@ -358,7 +366,7 @@ test_expect_success 'rename/directory conflict + content merge conflict' ' @@ -358,7 +366,7 @@ test_expect_success 'rename/directory conflict + content merge conflict' '
)
'

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 &&
@ -385,9 +393,10 @@ test_expect_success 'setup content merge + rename/directory conflict w/ disappea @@ -385,9 +393,10 @@ test_expect_success 'setup content merge + rename/directory conflict w/ disappea
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 &&

@ -416,10 +425,10 @@ test_expect_success 'disappearing dir in rename/directory conflict handled' ' @@ -416,10 +425,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_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 &&
@ -438,11 +447,12 @@ test_expect_success 'setup rename-with-content-merge vs. add' ' @@ -438,11 +447,12 @@ test_expect_success 'setup rename-with-content-merge vs. 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 &&
cd rename-with-content-merge-and-add-AB &&

git checkout A^0 &&

@ -483,8 +493,9 @@ test_expect_success 'handle rename-with-content-merge vs. add' ' @@ -483,8 +493,9 @@ 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 &&
cd rename-with-content-merge-and-add-BA &&

git reset --hard &&
git clean -fdx &&
@ -539,7 +550,7 @@ test_expect_success 'handle rename-with-content-merge vs. add, merge other way' @@ -539,7 +550,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_expect_success 'setup rename/rename (2to1) + modify/modify' '
test_setup_rename_rename_2to1 () {
test_create_repo rename-rename-2to1 &&
(
cd rename-rename-2to1 &&
@ -562,9 +573,10 @@ test_expect_success 'setup rename/rename (2to1) + modify/modify' ' @@ -562,9 +573,10 @@ test_expect_success 'setup rename/rename (2to1) + modify/modify' '
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 &&

@ -610,7 +622,7 @@ test_expect_success 'handle rename/rename (2to1) conflict correctly' ' @@ -610,7 +622,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_expect_success 'setup simple rename/rename (1to2) conflict' '
test_setup_rename_rename_1to2 () {
test_create_repo rename-rename-1to2 &&
(
cd rename-rename-1to2 &&
@ -631,9 +643,10 @@ test_expect_success 'setup simple rename/rename (1to2) conflict' ' @@ -631,9 +643,10 @@ test_expect_success 'setup simple rename/rename (1to2) conflict' '
test_tick &&
git commit -m C
)
'
}

test_expect_success 'merge has correct working tree contents' '
test_setup_rename_rename_1to2 &&
(
cd rename-rename-1to2 &&

@ -667,7 +680,7 @@ test_expect_success 'merge has correct working tree contents' ' @@ -667,7 +680,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_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 &&
@ -687,9 +700,10 @@ test_expect_success 'setup rename/rename(1to2)/add-source conflict' ' @@ -687,9 +700,10 @@ test_expect_success 'setup rename/rename(1to2)/add-source conflict' '
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 &&

@ -714,7 +728,7 @@ test_expect_failure 'detect conflict with rename/rename(1to2)/add-source merge' @@ -714,7 +728,7 @@ test_expect_failure 'detect conflict with rename/rename(1to2)/add-source merge'
)
'

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 &&
@ -737,9 +751,10 @@ test_expect_success 'setup rename/rename(1to2)/add-source resolvable conflict' ' @@ -737,9 +751,10 @@ test_expect_success 'setup rename/rename(1to2)/add-source resolvable conflict' '
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 &&

@ -759,7 +774,7 @@ test_expect_failure 'rename/rename/add-source still tracks new a file' ' @@ -759,7 +774,7 @@ test_expect_failure 'rename/rename/add-source still tracks new a file' '
)
'

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 &&
@ -784,9 +799,10 @@ test_expect_success 'setup rename/rename(1to2)/add-dest conflict' ' @@ -784,9 +799,10 @@ test_expect_success 'setup rename/rename(1to2)/add-dest conflict' '
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 &&

@ -838,7 +854,7 @@ test_expect_success 'rename/rename/add-dest merge still knows about conflicting @@ -838,7 +854,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_expect_success 'rad-setup: rename/add/delete conflict' '
test_setup_rad () {
test_create_repo rad &&
(
cd rad &&
@ -860,9 +876,10 @@ test_expect_success 'rad-setup: rename/add/delete conflict' ' @@ -860,9 +876,10 @@ test_expect_success 'rad-setup: rename/add/delete conflict' '
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 &&

@ -904,7 +921,7 @@ test_expect_failure 'rad-check: rename/add/delete conflict' ' @@ -904,7 +921,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_expect_success 'rrdd-setup: rename/rename(2to1)/delete/delete conflict' '
test_setup_rrdd () {
test_create_repo rrdd &&
(
cd rrdd &&
@ -927,9 +944,10 @@ test_expect_success 'rrdd-setup: rename/rename(2to1)/delete/delete conflict' ' @@ -927,9 +944,10 @@ test_expect_success 'rrdd-setup: rename/rename(2to1)/delete/delete conflict' '
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 &&

@ -973,7 +991,7 @@ test_expect_failure 'rrdd-check: rename/rename(2to1)/delete/delete conflict' ' @@ -973,7 +991,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_expect_success 'mod6-setup: chains of rename/rename(1to2) and rename/rename(2to1)' '
test_setup_mod6 () {
test_create_repo mod6 &&
(
cd mod6 &&
@ -1009,9 +1027,10 @@ test_expect_success 'mod6-setup: chains of rename/rename(1to2) and rename/rename @@ -1009,9 +1027,10 @@ test_expect_success 'mod6-setup: chains of rename/rename(1to2) and rename/rename
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 &&

@ -1108,7 +1127,8 @@ test_conflicts_with_adds_and_renames() { @@ -1108,7 +1127,8 @@ test_conflicts_with_adds_and_renames() {
# 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} &&
@ -1185,9 +1205,11 @@ test_conflicts_with_adds_and_renames() { @@ -1185,9 +1205,11 @@ 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} &&

@ -1254,7 +1276,7 @@ test_conflicts_with_adds_and_renames add add @@ -1254,7 +1276,7 @@ test_conflicts_with_adds_and_renames add add
#
# 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 &&
@ -1305,9 +1327,10 @@ test_expect_success 'setup nested conflicts from rename/rename(2to1)' ' @@ -1305,9 +1327,10 @@ test_expect_success 'setup nested conflicts from rename/rename(2to1)' '
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 &&


466
t/t6043-merge-rename-directories.sh

File diff suppressed because it is too large Load Diff

135
t/t6046-merge-skip-unneeded-updates.sh

@ -36,10 +36,10 @@ test_description="merge cases" @@ -36,10 +36,10 @@ test_description="merge cases"
# 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 &&
(
cd 1a &&
cd 1a_$1 &&

test_write_lines 1 2 3 4 5 6 7 8 9 10 >b &&
git add b &&
@ -62,13 +62,12 @@ test_expect_success '1a-setup: Modify(A)/Modify(B), change on B subset of A' ' @@ -62,13 +62,12 @@ test_expect_success '1a-setup: Modify(A)/Modify(B), change on B subset of A' '
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 &&
(
cd 1a &&
cd 1a_L &&

git checkout A^0 &&

@ -96,11 +95,10 @@ test_expect_success '1a-check-L: Modify(A)/Modify(B), change on B subset of A' ' @@ -96,11 +95,10 @@ test_expect_success '1a-check-L: Modify(A)/Modify(B), change on B subset of A' '
)
'

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 &&
(
cd 1a &&
cd 1a_R &&

git checkout B^0 &&

@ -133,10 +131,10 @@ test_expect_success '1a-check-R: Modify(A)/Modify(B), change on B subset of A' ' @@ -133,10 +131,10 @@ test_expect_success '1a-check-R: Modify(A)/Modify(B), change on B subset of A' '
# 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 &&
(
cd 2a &&
cd 2a_$1 &&

test_seq 1 10 >b &&
git add b &&
@ -158,13 +156,12 @@ test_expect_success '2a-setup: Modify(A)/rename(B)' ' @@ -158,13 +156,12 @@ test_expect_success '2a-setup: Modify(A)/rename(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 &&
(
cd 2a &&
cd 2a_L &&

git checkout A^0 &&

@ -189,11 +186,10 @@ test_expect_success '2a-check-L: Modify/rename, merge into modify side' ' @@ -189,11 +186,10 @@ test_expect_success '2a-check-L: Modify/rename, merge into modify side' '
)
'

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 &&
(
cd 2a &&
cd 2a_R &&

git checkout B^0 &&

@ -224,10 +220,10 @@ test_expect_success '2a-check-R: Modify/rename, merge into rename side' ' @@ -224,10 +220,10 @@ test_expect_success '2a-check-R: Modify/rename, merge into rename side' '
# 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 &&
(
cd 2b &&
cd 2b_$1 &&

test_write_lines 1 2 3 4 5 6 7 8 9 10 >b &&
git add b &&
@ -251,13 +247,12 @@ test_expect_success '2b-setup: Rename+Mod(A)/Mod(B), B mods subset of A' ' @@ -251,13 +247,12 @@ test_expect_success '2b-setup: Rename+Mod(A)/Mod(B), B mods subset of A' '
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 &&
(
cd 2b &&
cd 2b_L &&

git checkout A^0 &&

@ -288,11 +283,10 @@ test_expect_success '2b-check-L: Rename+Mod(A)/Mod(B), B mods subset of A' ' @@ -288,11 +283,10 @@ test_expect_success '2b-check-L: Rename+Mod(A)/Mod(B), B mods subset of A' '
)
'

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 &&
(
cd 2b &&
cd 2b_R &&

git checkout B^0 &&

@ -332,7 +326,7 @@ test_expect_success '2b-check-R: Rename+Mod(A)/Mod(B), B mods subset of A' ' @@ -332,7 +326,7 @@ test_expect_success '2b-check-R: Rename+Mod(A)/Mod(B), B mods subset of A' '
# 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_setup_2c () {
test_create_repo 2c &&
(
cd 2c &&
@ -358,9 +352,10 @@ test_expect_success '2c-setup: Modify b & add c VS rename b->c' ' @@ -358,9 +352,10 @@ test_expect_success '2c-setup: Modify b & add c VS rename b->c' '
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 &&
(
cd 2c &&

@ -428,10 +423,10 @@ test_expect_success '2c-check: Modify b & add c VS rename b->c' ' @@ -428,10 +423,10 @@ test_expect_success '2c-check: Modify b & add c VS rename b->c' '
# 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 &&
(
cd 3a &&
cd 3a_$1 &&

mkdir foo &&
test_seq 1 10 >bq &&
@ -456,13 +451,12 @@ test_expect_success '3a-setup: bq_1->foo/bq_2 on A, foo/->bar/ on B' ' @@ -456,13 +451,12 @@ test_expect_success '3a-setup: bq_1->foo/bq_2 on A, foo/->bar/ on 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 &&
(
cd 3a &&
cd 3a_L &&

git checkout A^0 &&

@ -487,11 +481,10 @@ test_expect_success '3a-check-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' ' @@ -487,11 +481,10 @@ test_expect_success '3a-check-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
)
'

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 &&
(
cd 3a &&
cd 3a_R &&

git checkout B^0 &&

@ -522,10 +515,10 @@ test_expect_success '3a-check-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' ' @@ -522,10 +515,10 @@ test_expect_success '3a-check-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
# 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 &&
(
cd 3b &&
cd 3b_$1 &&

mkdir foo &&
test_seq 1 10 >bq &&
@ -550,13 +543,12 @@ test_expect_success '3b-setup: bq_1->foo/bq_2 on A, foo/->bar/ on B' ' @@ -550,13 +543,12 @@ test_expect_success '3b-setup: bq_1->foo/bq_2 on A, foo/->bar/ on 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 &&
(
cd 3b &&
cd 3b_L &&

git checkout A^0 &&

@ -581,11 +573,10 @@ test_expect_success '3b-check-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' ' @@ -581,11 +573,10 @@ test_expect_success '3b-check-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
)
'

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 &&
(
cd 3b &&
cd 3b_R &&

git checkout B^0 &&

@ -621,7 +612,7 @@ test_expect_success '3b-check-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' ' @@ -621,7 +612,7 @@ test_expect_success '3b-check-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
# 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_setup_4a () {
test_create_repo 4a &&
(
cd 4a &&
@ -647,7 +638,7 @@ test_expect_success '4a-setup: Change on A, change on B subset of A, dirty mods @@ -647,7 +638,7 @@ test_expect_success '4a-setup: Change on A, change on B subset of A, dirty mods
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
@ -655,9 +646,8 @@ test_expect_success '4a-setup: Change on A, change on B subset of A, dirty mods @@ -655,9 +646,8 @@ test_expect_success '4a-setup: Change on A, change on B subset of A, dirty mods
# 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 &&
(
cd 4a &&

@ -695,7 +685,7 @@ test_expect_failure '4a-check: Change on A, change on B subset of A, dirty mods @@ -695,7 +685,7 @@ test_expect_failure '4a-check: Change on A, change on B subset of A, dirty mods
# 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_setup_4b () {
test_create_repo 4b &&
(
cd 4b &&
@ -722,11 +712,10 @@ test_expect_success '4b-setup: Rename+Mod(A)/Mod(B), change on B subset of A, di @@ -722,11 +712,10 @@ test_expect_success '4b-setup: Rename+Mod(A)/Mod(B), change on B subset of A, di
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 &&
(
cd 4b &&


Loading…
Cancel
Save