All of lore.kernel.org
 help / color / mirror / Atom feed
From: Charles Bailey <charles@hashpling.org>
To: git@vger.kernel.org
Cc: Caleb Cushing <xenoterracide@gmail.com>,
	Junio C Hamano <gitster@pobox.com>,
	Charles Bailey <charles@hashpling.org>
Subject: [PATCH] mergetool: demonstrate directory / file conflict breakage
Date: Tue, 24 Feb 2009 23:01:06 +0000	[thread overview]
Message-ID: <1235516466-3930-1-git-send-email-charles@hashpling.org> (raw)

---

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

             reply	other threads:[~2009-02-24 23:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-24 23:01 Charles Bailey [this message]
2009-02-24 23:01 ` [PATCH] Test refactor Charles Bailey
2009-02-24 23:05   ` Charles Bailey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1235516466-3930-1-git-send-email-charles@hashpling.org \
    --to=charles@hashpling.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=xenoterracide@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.