git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mergetool: demonstrate directory / file conflict breakage
@ 2009-02-24 23:01 Charles Bailey
  2009-02-24 23:01 ` [PATCH] Test refactor Charles Bailey
  0 siblings, 1 reply; 3+ messages in thread
From: Charles Bailey @ 2009-02-24 23:01 UTC (permalink / raw)
  To: git; +Cc: Caleb Cushing, Junio C Hamano, Charles Bailey

---

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-02-24 23:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-24 23:01 [PATCH] mergetool: demonstrate directory / file conflict breakage Charles Bailey
2009-02-24 23:01 ` [PATCH] Test refactor Charles Bailey
2009-02-24 23:05   ` Charles Bailey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).