[PATCH 07/37] t6022: Add paired rename+D/F conflict: (two/file, one/file) -> (one, two)

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Elijah Newren
Date: Monday, September 20, 2010 - 1:28 am

An interesting testcase is having two files each in their own subdirectory
getting renamed to the toplevel at the directory pathname of the other.
Questions arise as to whether the order of operations matters and whether
the directories can correctly get out of the way and make room for the
new files.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 t/t6022-merge-rename.sh |   63 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 63 insertions(+), 0 deletions(-)

diff --git a/t/t6022-merge-rename.sh b/t/t6022-merge-rename.sh
index 2af863c..a38b383 100755
--- a/t/t6022-merge-rename.sh
+++ b/t/t6022-merge-rename.sh
@@ -565,4 +565,67 @@ test_expect_failure 'both rename source and destination involved in D/F conflict
 	test "stuff" = "$(cat destdir~HEAD)"
 '
 
+test_expect_success 'setup pair rename to parent of other (D/F conflicts)' '
+	git reset --hard &&
+	git checkout --orphan rename-two &&
+	git rm -rf . &&
+	git clean -fdqx &&
+
+	mkdir one &&
+	mkdir two &&
+	echo stuff >one/file &&
+	echo other >two/file &&
+	git add -A &&
+	git commit -m "Common commmit" &&
+
+	git rm -rf one &&
+	git mv two/file one &&
+	git commit -m "Rename two/file -> one" &&
+
+	git checkout -b rename-one HEAD~1 &&
+	git rm -rf two &&
+	git mv one/file two &&
+	rm -r one &&
+	git commit -m "Rename one/file -> two"
+'
+
+test_expect_failure 'pair rename to parent of other (D/F conflicts) w/ untracked dir' '
+	git checkout -q rename-one^0 &&
+	mkdir one &&
+	test_must_fail git merge --strategy=recursive rename-two &&
+
+	test 2 = "$(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_must_fail git diff --quiet &&
+
+	test 4 = $(find . | grep -v .git | wc -l) &&
+
+	test -d one &&
+	test -f one~rename-two &&
+	test -f two &&
+	test "other" = $(cat one~rename-two) &&
+	test "stuff" = $(cat two)
+'
+
+test_expect_success 'pair rename to parent of other (D/F conflicts) w/ clean start' '
+	git reset --hard &&
+	git clean -fdqx &&
+	test_must_fail git merge --strategy=recursive rename-two &&
+
+	test 2 = "$(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_must_fail git diff --quiet &&
+
+	test 3 = $(find . | grep -v .git | wc -l) &&
+
+	test -f one &&
+	test -f two &&
+	test "other" = $(cat one) &&
+	test "stuff" = $(cat two)
+'
+
 test_done
-- 
1.7.3.271.g16009

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 07/37] t6022: Add paired rename+D/F conflict: (two/ ..., Elijah Newren, (Mon Sep 20, 1:28 am)
[PATCH 09/37] t6020: Modernize style a bit, Elijah Newren, (Mon Sep 20, 1:28 am)
[PATCH 13/37] t6036: Add testcase for undetected conflict, Elijah Newren, (Mon Sep 20, 1:28 am)
Re: [PATCH 09/37] t6020: Modernize style a bit, Johannes Sixt, (Mon Sep 20, 2:24 am)
Re: [PATCH 09/37] t6020: Modernize style a bit, Elijah Newren, (Mon Sep 20, 9:03 am)
Re: [PATCH 09/37] t6020: Modernize style a bit, Junio C Hamano, (Tue Sep 21, 6:44 pm)
Re: [PATCH 09/37] t6020: Modernize style a bit, Elijah Newren, (Tue Sep 21, 9:41 pm)