summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Elijah Newren <newren@gmail.com>2010-09-20 02:28:41 -0600
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-09-29 17:32:36 -0700
commit707983484b7dcdd5fe3e09b30d0fdf6dac89c940 (patch)
treeb8e62ff1c6964f8f2af3c343730aedef47df1c3b /t
parentt6022: Add paired rename+D/F conflict: (two/file, one/file) -> (one, two) (diff)
downloadtgif-707983484b7dcdd5fe3e09b30d0fdf6dac89c940.tar.xz
t6022: Add tests for rename/rename combined with D/F conflicts
Add tests where one file is renamed to two different paths in different sides of history, and where each of the new files matches the name of a directory from the opposite side of history. Include tests for both the case where the merge results in those directories not being cleanly removed, and where those directories are cleanly removed during the merge. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t6022-merge-rename.sh79
1 files changed, 79 insertions, 0 deletions
diff --git a/t/t6022-merge-rename.sh b/t/t6022-merge-rename.sh
index a38b383c89..02dea16459 100755
--- a/t/t6022-merge-rename.sh
+++ b/t/t6022-merge-rename.sh
@@ -628,4 +628,83 @@ test_expect_success 'pair rename to parent of other (D/F conflicts) w/ clean sta
test "stuff" = $(cat two)
'
+test_expect_success 'setup rename of one file to two, with directories in the way' '
+ git reset --hard &&
+ git checkout --orphan first-rename &&
+ git rm -rf . &&
+ git clean -fdqx &&
+
+ echo stuff >original &&
+ git add -A &&
+ git commit -m "Common commmit" &&
+
+ mkdir two &&
+ >two/file &&
+ git add two/file &&
+ git mv original one &&
+ git commit -m "Put two/file in the way, rename to one" &&
+
+ git checkout -b second-rename HEAD~1 &&
+ mkdir one &&
+ >one/file &&
+ git add one/file &&
+ git mv original two &&
+ git commit -m "Put one/file in the way, rename to two"
+'
+
+test_expect_failure 'check handling of differently renamed file with D/F conflicts' '
+ git checkout -q first-rename^0 &&
+ test_must_fail git merge --strategy=recursive second-rename &&
+
+ test 5 = "$(git ls-files -s | wc -l)" &&
+ test 3 = "$(git ls-files -u | wc -l)" &&
+ test 1 = "$(git ls-files -u one | wc -l)" &&
+ test 1 = "$(git ls-files -u two | wc -l)" &&
+ test 1 = "$(git ls-files -u original | wc -l)" &&
+ test 2 = "$(git ls-files -o | wc -l)" &&
+
+ test -f one/file &&
+ test -f two/file &&
+ test -f one~HEAD &&
+ test -f two~second-rename &&
+ ! test -f original
+'
+
+test_expect_success 'setup rename one file to two; directories moving out of the way' '
+ git reset --hard &&
+ git checkout --orphan first-rename-redo &&
+ git rm -rf . &&
+ git clean -fdqx &&
+
+ echo stuff >original &&
+ mkdir one two &&
+ touch one/file two/file &&
+ git add -A &&
+ git commit -m "Common commmit" &&
+
+ git rm -rf one &&
+ git mv original one &&
+ git commit -m "Rename to one" &&
+
+ git checkout -b second-rename-redo HEAD~1 &&
+ git rm -rf two &&
+ git mv original two &&
+ git commit -m "Rename to two"
+'
+
+test_expect_failure 'check handling of differently renamed file with D/F conflicts' '
+ git checkout -q first-rename-redo^0 &&
+ test_must_fail git merge --strategy=recursive second-rename-redo &&
+
+ test 3 = "$(git ls-files -u | wc -l)" &&
+ test 1 = "$(git ls-files -u one | wc -l)" &&
+ test 1 = "$(git ls-files -u two | wc -l)" &&
+ test 1 = "$(git ls-files -u original | wc -l)" &&
+ test 0 = "$(git ls-files -o | wc -l)" &&
+
+ test -f one &&
+ test -f two &&
+ ! test -f original
+'
+
test_done