summaryrefslogtreecommitdiff
path: root/t/t6022-merge-rename.sh
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2010-09-20 08:28:41 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-09-30 00:32:36 (GMT)
commit707983484b7dcdd5fe3e09b30d0fdf6dac89c940 (patch)
treeb8e62ff1c6964f8f2af3c343730aedef47df1c3b /t/t6022-merge-rename.sh
parent52304ecddf9458dcf4321c89c96a5e1bc025676d (diff)
downloadgit-707983484b7dcdd5fe3e09b30d0fdf6dac89c940.zip
git-707983484b7dcdd5fe3e09b30d0fdf6dac89c940.tar.gz
git-707983484b7dcdd5fe3e09b30d0fdf6dac89c940.tar.bz2
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/t6022-merge-rename.sh')
-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 a38b383..02dea16 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