git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: "David D. Kilzer" <ddkilzer@kilzer.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH 5/5] rebase: protect against diff.renames configuration
Date: Fri, 23 Jul 2010 12:06:13 -0500	[thread overview]
Message-ID: <20100723170613.GF2507@burratino> (raw)
In-Reply-To: <20100723170103.GA2507@burratino>

From: Junio C Hamano <gitster@pobox.com>
Date: Mon, 10 Nov 2008 16:15:49 -0800

We currently do not disable diff.renames configuration while rebase
internally runs "format-patch" to feed "am -3".

The end user configuration for "diff" should not affect the result
produced by the higher level command that is related to "diff" only
because internally it is implemented in terms of it.

For that matter, I have a feeling that format-patch should not even look
at diff.renames, but we seem to have been doing this for a long time so
there is no easy way to fix this thinko.

In any case, here is a much straightforward fix for "rebase".

[jn: with test case from David]

Reported-by: David D. Kilzer <ddkilzer@kilzer.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 git-rebase.sh     |    2 +-
 t/t3400-rebase.sh |   24 +++++++++++++++++++++++-
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/git-rebase.sh b/git-rebase.sh
index ab4afa7..386be43 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -543,7 +543,7 @@ fi
 if test -z "$do_merge"
 then
 	git format-patch -k --stdout --full-index --ignore-if-in-upstream \
-		$root_flag "$revisions" |
+		--no-renames $root_flag "$revisions" |
 	git am $git_am_opt --rebasing --resolvemsg="$RESOLVEMSG" &&
 	move_to_original_branch
 	ret=$?
diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index 083d768..a19aeb6 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -19,7 +19,16 @@ test_expect_success 'prepare repository with topic branches' '
 	echo First >A &&
 	git update-index --add A &&
 	git commit -m "Add A." &&
-	git checkout -b my-topic-branch &&
+	git checkout -b force-3way &&
+	echo Dummy >Y &&
+	git update-index --add Y &&
+	git commit -m "Add Y." &&
+	git checkout -b filemove &&
+	git reset --soft master &&
+	mkdir D &&
+	git mv A D/A &&
+	git commit -m "Move A." &&
+	git checkout -b my-topic-branch master &&
 	echo Second >B &&
 	git update-index --add B &&
 	git commit -m "Add B." &&
@@ -128,6 +137,19 @@ test_expect_success 'rebase a single mode change' '
 	GIT_TRACE=1 git rebase master
 '
 
+test_expect_success 'rebase is not broken by diff.renames' '
+	git config diff.renames copies &&
+	test_when_finished "git config --unset diff.renames" &&
+	git checkout filemove &&
+	GIT_TRACE=1 git rebase force-3way
+'
+
+test_expect_success 'setup: recover' '
+	test_might_fail git rebase --abort &&
+	git reset --hard &&
+	git checkout modechange
+'
+
 test_expect_success 'Show verbose error when HEAD could not be detached' '
 	>B &&
 	test_must_fail git rebase topic 2>output.err >output.out &&
-- 
1.7.2.rc3

  parent reply	other threads:[~2010-07-23 17:07 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-10 22:26 [PATCH] 3-way merge with file move fails when diff.renames = copies David D. Kilzer
2008-11-10 23:41 ` Johannes Schindelin
2008-11-10 23:53   ` [PATCH] Fix 3-way merge with file move " David D. Kilzer
2008-11-10 23:49 ` [PATCH] 3-way merge with file move fails " Junio C Hamano
2008-11-11  0:06   ` David D. Kilzer
2008-11-11  0:15   ` Junio C Hamano
2010-07-21 19:58     ` [PATCH] Fix rebase with file move " David D. Kilzer
2010-07-21 21:54       ` Junio C Hamano
2010-07-22  0:22         ` David D. Kilzer
2010-07-22  7:51       ` Jonathan Nieder
2010-07-22 21:59         ` David D. Kilzer
2010-07-23 17:01           ` [PATCH 0/5] " Jonathan Nieder
2010-07-23 17:03             ` [PATCH 1/5] t4150 (am): style tweaks Jonathan Nieder
2010-07-23 17:04             ` [PATCH 2/5] t4150 (am): futureproof against failing tests Jonathan Nieder
2010-07-23 17:04             ` [PATCH 3/5] Teach "apply --index-info" to handle rename patches Jonathan Nieder
2010-07-23 17:05             ` [PATCH 4/5] t3400 (rebase): whitespace cleanup Jonathan Nieder
2010-07-23 17:06             ` Jonathan Nieder [this message]
2010-07-23 19:51               ` [PATCH 5/5] rebase: protect against diff.renames configuration Sverre Rabbelier
2010-07-23 21:03                 ` Junio C Hamano
2010-07-23 19:53               ` Sverre Rabbelier
2010-07-23 18:47             ` [PATCH 0/5] Fix rebase with file move when diff.renames = copies David D. Kilzer
2010-07-24 21:59               ` Jonathan Nieder

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=20100723170613.GF2507@burratino \
    --to=jrnieder@gmail.com \
    --cc=ddkilzer@kilzer.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    /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).