From: Michael J Gruber <git@drmicha.warpmail.net>
To: Jeff King <peff@peff.net>
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Mart Sõmermaa" <mrts.pydev@gmail.com>,
git@vger.kernel.org
Subject: Re: git diff: add option for omitting the contents of deletes
Date: Mon, 28 Feb 2011 14:05:37 +0100 [thread overview]
Message-ID: <4D6B9DA1.4070805@drmicha.warpmail.net> (raw)
In-Reply-To: <20110228125909.GA9054@sigill.intra.peff.net>
Jeff King venit, vidit, dixit 28.02.2011 13:59:
> On Mon, Feb 28, 2011 at 01:32:35PM +0100, Michael J Gruber wrote:
>
>>> Actually, thinking on this a bit more, I guess "-M" and "-C" are usable
>>> without the sha1. In fact, we don't even provide it for a strict 100%
>>> rename, and for a rename-with-patch, you can apply the patch, assuming
>>> you have the original file in any form. So they are really about "is
>>> your recipient using git", not "is your recipient using git _and_ will
>>> he/she have the right sha1".
>>
>> $ git mv Makefile Dofile
>> $ git staged # yadayada
>> diff --git c/Makefile i/Dofile
>> similarity index 100%
>> rename from Makefile
>> rename to Dofile
>>
>> Same with copy.
>>
>> But that's not good, is it? I mean, Alice sends me her "copy patch" and
>> I send her my Makefile patch, both on top of the same base. We both
>> apply each other's patch cleanly. We end up with different "Dofile".
>> Checking the sha1 would prevent this. It's no surprise that patch
>> application is non-commutative, but shouldn't we catch this?
>
> Won't you either get a conflict or end up with the same Dofile? Clearly
> you will have a Dofile with your Makefile changes, as you applied the
> movement on top of your changes.
>
> Alice will either:
>
> 1. Apply not using rename detection (e.g., not using git, or using
> "git am" without "-3"). In this case, she gets a conflict because
> she no longer has Makefile.
>
When I said "copy patch" I actually meant a patch which records the copy
"Makefile -> Dofile". What is it today? Is it me? I know I wrote the
"mv" example first, but still :)
I mean, Alice:
cp Makefile Dofile
sends me a -C patch
I:
Break everything by hacking Makefile
send her a crappy patch
Both:
apply the received patch
Now I end up with a borked Makefile and a borked Dofile, but Alice still
has a good Dofile, and it's all my fault, so I don't deserve any better.
But still.
> 2. Apply using rename detection (e.g., via "git am -3"). In this case,
> we will notice the movement of Makefile to Dofile, and apply the
> patch to Dofile.
>
> Still, I do wonder if we should be including an index line on a straight
> rename patch. It lets the recipient check that what is being renamed is
> what they have (IOW, it gives the same check that they would do if they
> ahd the whole patch text). And then the recipient can decide how to
> resolve the conflict.
I think so. (Or make -f force it.)
This is orthogonal to the "-D" suggestion", but "-D" could write the
index line to start with.
Michael
next prev parent reply other threads:[~2011-02-28 13:09 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-26 13:16 git diff: add option for omitting the contents of deletes Mart Sõmermaa
2011-02-26 20:11 ` Junio C Hamano
2011-02-27 14:41 ` Michael J Gruber
2011-02-27 22:33 ` Mart Sõmermaa
2011-02-28 9:58 ` Michael J Gruber
2011-02-28 10:51 ` Mart Sõmermaa
2011-02-27 22:54 ` Junio C Hamano
2011-02-27 23:07 ` Junio C Hamano
2011-02-28 7:31 ` Michael J Gruber
2011-02-28 12:17 ` Jeff King
2011-02-28 12:23 ` Jeff King
2011-02-28 12:32 ` Michael J Gruber
2011-02-28 12:59 ` Jeff King
2011-02-28 13:05 ` Michael J Gruber [this message]
2011-02-28 21:54 ` Jeff King
2011-02-28 18:11 ` Junio C Hamano
2011-02-28 22:23 ` Jeff King
2011-02-28 23:28 ` Junio C Hamano
2011-03-01 0:11 ` Junio C Hamano
2011-03-07 20:38 ` Mart Sõmermaa
2011-03-08 7:14 ` Michael J Gruber
2011-03-08 19:49 ` Junio C Hamano
2011-03-08 21:25 ` Mart Sõmermaa
2011-03-08 21:31 ` Jeff King
2011-02-28 12:42 ` symling diff driver (Was: Re: git diff: add option for omitting the contents of deletes) Michael J Gruber
2011-02-28 13:08 ` Jeff King
2011-02-28 15:26 ` [PATCH/WIP] attr: make attributes depend on file type Michael J Gruber
2011-02-28 17:30 ` Jeff King
2011-02-28 17:48 ` Junio C Hamano
2011-03-01 7:46 ` Michael J Gruber
2011-02-28 10:45 ` git diff: add option for omitting the contents of deletes Mart Sõmermaa
2011-02-28 16:10 ` Michael J Gruber
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=4D6B9DA1.4070805@drmicha.warpmail.net \
--to=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mrts.pydev@gmail.com \
--cc=peff@peff.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;
as well as URLs for NNTP newsgroup(s).