git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Clemens Buchacher <drizzd@aon.at>
To: git@vger.kernel.org
Cc: Miklos Vajna <vmiklos@frugalware.org>,
	Michael Johnson <redbeard@mdjohnson.us>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Clemens Buchacher <drizzd@aon.at>
Subject: [PATCH 2/3] update cache for conflicting submodule entries
Date: Sun,  5 Apr 2009 02:46:59 +0200	[thread overview]
Message-ID: <1238892420-721-3-git-send-email-drizzd@aon.at> (raw)
In-Reply-To: <1238892420-721-2-git-send-email-drizzd@aon.at>

When merging merge bases during a recursive merge we do not want to
leave any unmerged entries. Otherwise we cannot create a temporary
tree for the recursive merge to work with.

We failed to do so in case of a submodule conflict between merge
bases, causing a NULL pointer dereference in the next step of the
recursive merge.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
---
 merge-recursive.c          |    5 +++--
 t/t7405-submodule-merge.sh |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/merge-recursive.c b/merge-recursive.c
index 3e1bc3e..f1b120b 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1118,10 +1118,11 @@ static int process_entry(struct merge_options *o,
 		clean_merge = mfi.clean;
 		if (mfi.clean)
 			update_file(o, 1, mfi.sha, mfi.mode, path);
-		else if (S_ISGITLINK(mfi.mode))
+		else if (S_ISGITLINK(mfi.mode)) {
 			output(o, 1, "CONFLICT (submodule): Merge conflict in %s "
 			       "- needs %s", path, sha1_to_hex(b.sha1));
-		else {
+			update_file(o, 0, mfi.sha, mfi.mode, path);
+		} else {
 			output(o, 1, "CONFLICT (%s): Merge conflict in %s",
 					reason, path);
 
diff --git a/t/t7405-submodule-merge.sh b/t/t7405-submodule-merge.sh
index 9778ad4..aa6c44c 100755
--- a/t/t7405-submodule-merge.sh
+++ b/t/t7405-submodule-merge.sh
@@ -63,7 +63,7 @@ test_expect_failure 'merging with modify/modify conflict' '
 
 '
 
-test_expect_failure 'merging with a modify/modify conflict between merge bases' '
+test_expect_success 'merging with a modify/modify conflict between merge bases' '
 
 	git reset --hard HEAD &&
 	git checkout -b test2 c &&
-- 
1.6.2.1

  reply	other threads:[~2009-04-05  0:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-28 16:19 Segfault on merge with 1.6.2.1 Michael Johnson
2009-03-29 12:17 ` Miklos Vajna
2009-03-30  2:39   ` Michael Johnson
2009-03-30  7:48     ` Johannes Schindelin
2009-03-30 11:03     ` Miklos Vajna
2009-03-31  7:14       ` Michael Johnson
2009-04-01  5:43         ` Michael Johnson
2009-04-01  9:50           ` Miklos Vajna
2009-04-01 18:06         ` Clemens Buchacher
2009-04-02  0:33           ` Michael Johnson
2009-04-05  0:46           ` Clemens Buchacher
2009-04-05  0:46             ` [PATCH 1/3] add tests for merging with submodules Clemens Buchacher
2009-04-05  0:46               ` Clemens Buchacher [this message]
2009-04-05  0:47                 ` [PATCH 3/3] simplify output of conflicting merge Clemens Buchacher
2009-04-05  9:47                   ` Junio C Hamano
2009-04-05 11:50             ` Segfault on merge with 1.6.2.1 Johannes Schindelin
2009-04-06  2:29             ` Michael Johnson
2009-04-06  6:41               ` Clemens Buchacher

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=1238892420-721-3-git-send-email-drizzd@aon.at \
    --to=drizzd@aon.at \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=redbeard@mdjohnson.us \
    --cc=vmiklos@frugalware.org \
    /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 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).