aboutsummaryrefslogtreecommitdiff
path: root/t/t6022-merge-rename.sh
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2010-09-20 02:28:39 -0600
committerJunio C Hamano <gitster@pobox.com>2010-09-29 17:32:36 -0700
commit588504b694133cba85982fbace532d2156f859eb (patch)
tree7d47cc5892a65e3eb5a66f0ac5a44afff0c79125 /t/t6022-merge-rename.sh
parent3398f2f58317e1a22093a0149a5eae1fe208b024 (diff)
downloadgit-588504b694133cba85982fbace532d2156f859eb.tar.gz
git-588504b694133cba85982fbace532d2156f859eb.tar.xz
t6022: Add tests with both rename source & dest involved in D/F conflicts
Having the source of a rename be involved in a directory/file conflict does not currently pose any difficulties to the current merge-recursive algorithm (in contrast to destinations of renames and D/F conflicts). However, combining the two seemed like good testcases to include for completeness. 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.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/t/t6022-merge-rename.sh b/t/t6022-merge-rename.sh
index 2839dfb5e..2af863c12 100755
--- a/t/t6022-merge-rename.sh
+++ b/t/t6022-merge-rename.sh
@@ -527,4 +527,42 @@ test_expect_failure 'Same as previous, but merged other way' '
test_cmp expected dir~renamed-file-has-conflicts
'
+test_expect_success 'setup both rename source and destination involved in D/F conflict' '
+ git reset --hard &&
+ git checkout --orphan rename-dest &&
+ git rm -rf . &&
+ git clean -fdqx &&
+
+ mkdir one &&
+ echo stuff >one/file &&
+ git add -A &&
+ git commit -m "Common commmit" &&
+
+ git mv one/file destdir &&
+ git commit -m "Renamed to destdir" &&
+
+ git checkout -b source-conflict HEAD~1 &&
+ git rm -rf one &&
+ mkdir destdir &&
+ touch one destdir/foo &&
+ git add -A &&
+ git commit -m "Conflicts in the way"
+'
+
+test_expect_failure 'both rename source and destination involved in D/F conflict' '
+ git reset --hard &&
+ rm -rf dir~* &&
+ git checkout -q rename-dest^0 &&
+ test_must_fail git merge --strategy=recursive source-conflict &&
+
+ test 1 = "$(git ls-files -u | wc -l)" &&
+
+ test_must_fail git diff --quiet &&
+
+ test -f destdir/foo &&
+ test -f one &&
+ test -f destdir~HEAD &&
+ test "stuff" = "$(cat destdir~HEAD)"
+'
+
test_done