mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <>
Subject: Re: [RFC PATCH] diff: do not use creation-half of -B as a rename target candidate
Date: Mon, 02 Feb 2015 10:25:39 -0800	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <> (Junio C. Hamano's message of "Sun, 01 Feb 2015 19:18:35 -0800")

Junio C Hamano <> writes:

>  * Here is what I am at the moment; I cannot quite explain (hence I
>    cannot convince myself) why this is the right solution, but it
>    seems to make the above sample case work without breaking any
>    existing tests.  It is possible that the tests that would break
>    without the "&& !p->score" bit are expecting wrong results, but I
>    didn't look at them in detail.

Sadly, I think this is garbage.  "Do not consider creation-half of a
broken pair, ever" is too simple and cripples this case that starts
with two files A and B that are quite different:

	$ git add A B
	$ mv A
        $ mv B A
        $ mv B
        $ git diff -B -M

where the internal machinery breaks both A and B into these two file

	delete A(old)
        create A(new)

	delete B(old)
        create B(new)

and then match them up to produce

	rename A to B
        rename B to A

The rule need to be "creation-half of a broken pair can be used as
the destination of a rename, if and only if its corresponding
deletion-half is used as the source of another rename elsewhere".
Under that condition, a file A that is completely rewritten to
become similar to another existing file B can be expressed as a
rename of B, because A is renamed away to make room in the same

Fixing this is turning out to be more complex than I originally
hoped X-<.

      parent reply	other threads:[~2015-02-02 18:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-31 19:12 [Git BUG] Please do not use "-B -M" in "diff" family for now Junio C Hamano
2015-02-02  3:18 ` [RFC PATCH] diff: do not use creation-half of -B as a rename target candidate Junio C Hamano
2015-02-02  5:52   ` Stefan Beller
2015-02-02  6:47     ` Yue Lin Ho
2015-02-02 18:25   ` Junio C Hamano [this message]

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:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* 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.
Code repositories for project(s) associated with this public inbox

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 read-only IMAP folder(s) and NNTP newsgroup(s).