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: Re: [PATCH] Fix rebase with file move when diff.renames = copies
Date: Thu, 22 Jul 2010 02:51:33 -0500 [thread overview]
Message-ID: <20100722075133.GA9292@burratino> (raw)
In-Reply-To: <1279742303-29817-1-git-send-email-ddkilzer@kilzer.net>
David D. Kilzer wrote:
> With diff.renames = copies, a rebase with a file move will fail with
> the following error:
>
> fatal: mode change for <file>, which is not in current HEAD
> Repository lacks necessary blobs to fall back on 3-way merge.
> Cannot fall back to three-way merge.
> Patch failed at 0001.
I would think that the following works fine:
git init test-repo &&
cd test-repo &&
echo hello >greeting.txt &&
git add greeting.txt &&
git commit -m base &&
git checkout -b move &&
git mv greeting.txt moved.txt &&
git commit -m move &&
git checkout master &&
echo hi >greeting.txt &&
git add greeting.txt &&
git commit -m change &&
git checkout move &&
echo '[diff] renames = copies' >>.git/config &&
git rebase master
What am I doing wrong?
On the other hand I find Junio’s explanation[1] compelling
already on its own.
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.
In cases where a patch copies a file that was then removed on the
mainline, my intuition says ‘rebase’ without some extra flag should
accept the change without complaint. Of course, this intuition is
totally warped --- I tend to think of rebase as diff + apply.
Patch does not apply to master or maint, due to conflict with
v1.7.1-rc0~37^2~5 (rebase: support automatic notes copying,
2010-03-12). One sneaky way to avoid this kind of thing would be to
insert new tests at some logical point in the middle of a test script.
Test nitpicks:
> +++ b/t/t3400-rebase.sh
> @@ -155,4 +155,21 @@ test_expect_success 'Rebase a commit that sprinkles CRs in' '
> git diff --exit-code file-with-cr:CR HEAD:CR
> '
>
> +test_expect_success 'rebase a single file move with diff.renames = copies' '
> + git config diff.renames copies &&
Use
test_when_finished "git config --unset diff.renames" &&
to shelter future tests from the effect of this one.
> + git checkout master &&
> + echo 1 > Y &&
> + git add Y &&
> + test_tick &&
> + git commit -m "prepare file move" &&
commit: new file Y.
> + git checkout -b filemove HEAD^ &&
> + echo 1 > Y &&
> + git add Y &&
> + mkdir D &&
> + git mv A D/A &&
> + test_tick &&
> + git commit -m filemove &&
commit: new file Y, rename A to D/A.
> + GIT_TRACE=1 git rebase master
This wants to notice that Y was already added so the top patch can be
simplified to include only a rename.
Can you explain why this test will fail without your patch?
Thanks,
Jonathan
[1] http://thread.gmane.org/gmane.comp.version-control.git/100583/focus=100606
next prev parent reply other threads:[~2010-07-22 7:52 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 [this message]
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 ` [PATCH 5/5] rebase: protect against diff.renames configuration Jonathan Nieder
2010-07-23 19:51 ` 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=20100722075133.GA9292@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).