[PATCH] mergetool: demonstrate directory / file conflict breakage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---

This appears to demonstrate one of the corner cases that trips mergetool
up. I also appear to have fixed it in my work-in-progress refactoring of
mergetool, but I haven't yet completed it or tested it thoroughly enough
so it's not ready for human consumption.

 t/t7610-mergetool.sh |   49 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh
index e768c3e..df57b83 100755
--- a/t/t7610-mergetool.sh
+++ b/t/t7610-mergetool.sh
@@ -34,6 +34,8 @@ test_expect_success 'setup' '
     git add file1 file2 subdir/file3 &&
     git commit -m "master updates" &&
 
+    git branch empty $(echo empty | git commit-tree $(printf "" | git mktree)) &&
+
     git config merge.tool mytool &&
     git config mergetool.mytool.cmd "cat \"\$REMOTE\" >\"\$MERGED\"" &&
     git config mergetool.mytool.trustExitCode true
@@ -67,13 +69,56 @@ test_expect_success 'mergetool crlf' '
 '
 
 test_expect_success 'mergetool in subdir' '
-    git checkout -b test3 branch1
-    cd subdir && (
+    git checkout -b test3 branch1 &&
+    ( cd subdir &&
     test_must_fail git merge master >/dev/null 2>&1 &&
     ( yes "" | git mergetool file3 >/dev/null 2>&1 ) &&
     test "$(cat file3)" = "master new sub" )
 '
 
+# Choosing the 'remote' symlink should work
+test_expect_success 'mergetool symlink change' '
+    git clean -f &&
+    git checkout -f -b symlink-test empty &&
+    echo file >file1 &&
+    echo file >linktofile1 &&
+    git add file1 linktofile1 &&
+    git commit -m base &&
+    rm linktofile1 &&
+    ln -s file1 linktofile1 &&
+    git commit -a -m "change file to link" &&
+    git checkout -b symlink-test-2 HEAD^ &&
+    rm linktofile1 &&
+    printf file1 >linktofile1 &&
+    git commit -a -m "file change" &&
+    test_must_fail git merge symlink-test >/dev/null 2>&1 &&
+    ( yes "r" | git mergetool linktofile1 >/dev/null 2>&1 ) &&
+    test -L linktofile1 &&
+    git commit -m "symlink resolve"
+'
+
+# Aborting a conflicted dir -> file merge shouldn't remove the offending
+# parth altogether
+test_expect_failure 'abort mergetool directory change' '
+    git clean -f &&
+    git checkout -f -b dir-test empty &&
+    echo file >dir1 &&
+    git add dir1 &&
+    git commit -m base &&
+    rm dir1 &&
+    mkdir dir1 &&
+    echo file >dir1/file &&
+    git add dir1
+    git commit -a -m "change file to dir" &&
+    git checkout -b dir-test-2 HEAD^ &&
+    echo not a dir >dir1 &&
+    git commit -a -m "file change" &&
+    test_must_fail git merge -s resolve dir-test &&
+    test -e dir1 &&
+    ( yes "a" | test_must_fail git mergetool dir1 >/dev/null 2>&1 ) &&
+    test -e dir1
+'
+
 # We can't merge files from parent directories when running mergetool
 # from a subdir. Is this a bug?
 #
-- 
1.6.2.rc1.258.g314b8b

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux