Git development
 help / color / mirror / Atom feed
From: Alex Riesen <raa.lkml@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <junkio@cox.net>
Subject: [PATCH] Add a test for merging changed and rename-changed branches
Date: Wed, 25 Apr 2007 22:07:45 +0200	[thread overview]
Message-ID: <20070425200745.GC30061@steel.home> (raw)

Also leave a warning for future merge-recursive explorers.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
 merge-recursive.c       |    5 +++++
 t/t6022-merge-rename.sh |   23 +++++++++++++++++++++++
 2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/merge-recursive.c b/merge-recursive.c
index 37f1ba9..094ac59 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1345,6 +1345,11 @@ static int process_renames(struct path_list *a_renames,
 				if (mfi.merge && mfi.clean &&
 				    sha_eq(mfi.sha, ren1->pair->two->sha1) &&
 				    mfi.mode == ren1->pair->two->mode)
+					/*
+					 * This messaged is part of
+					 * t6022 test. If you change
+					 * it update the test too.
+					 */
 					output(3, "Skipped %s (merged same as existing)", ren1_dst);
 				else {
 					if (mfi.merge || !mfi.clean)
diff --git a/t/t6022-merge-rename.sh b/t/t6022-merge-rename.sh
index 99817de..200d9fe 100755
--- a/t/t6022-merge-rename.sh
+++ b/t/t6022-merge-rename.sh
@@ -47,6 +47,8 @@ git branch white &&
 git branch red &&
 git branch blue &&
 git branch yellow &&
+git branch change &&
+git branch change+rename &&
 
 sed -e "/^g /s/.*/g : master changes a line/" <A >A+ &&
 mv A+ A &&
@@ -77,6 +79,17 @@ rm -f A M &&
 git update-index --add --remove A C M N &&
 git commit -m "blue renames A->C, M->N" &&
 
+git checkout change &&
+sed -e "/^g /s/.*/g : changed line/" <A >A+ &&
+mv A+ A &&
+git commit -q -a -m "changed" &&
+
+git checkout change+rename &&
+sed -e "/^g /s/.*/g : changed line/" <A >B &&
+rm A &&
+git update-index --add B &&
+git commit -q -a -m "changed and renamed" &&
+
 git checkout master'
 
 test_expect_success 'merge renaming branch into unrenaming one' \
@@ -318,4 +331,14 @@ test_expect_success 'interference with untracked working tree file' '
 	git reset --hard anchor
 '
 
+test_expect_success 'merge of identical changes in a renamed file' '
+	rm -f A M N
+	git reset --hard &&
+	git checkout change+rename &&
+	GIT_MERGE_VERBOSITY=3 git merge change | grep "^Skipped B" &&
+	git reset --hard HEAD^ &&
+	git checkout change &&
+	GIT_MERGE_VERBOSITY=3 git merge change+rename | grep "^Skipped B"
+'
+
 test_done
-- 
1.5.2.rc0.63.gdfc8-dirty

                 reply	other threads:[~2007-04-25 20:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20070425200745.GC30061@steel.home \
    --to=raa.lkml@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /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