git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Zbigniew Jędrzejewski-Szmek" <zbyszek@in.waw.pl>,
	"Randal L. Schwartz" <merlyn@stonehenge.com>,
	"Ralf Nyren" <ralf.nyren@ericsson.com>,
	git@vger.kernel.org
Subject: Re: [PATCH 3/3] merge-recursive: don't detect renames from empty files
Date: Thu, 22 Mar 2012 17:53:55 -0400	[thread overview]
Message-ID: <20120322215355.GA750@sigill.intra.peff.net> (raw)
In-Reply-To: <20120322191851.GA23293@burratino>

On Thu, Mar 22, 2012 at 02:18:51PM -0500, Jonathan Nieder wrote:

> > We could do the same thing for general diff rename
> > detection. However, the stakes are much less high there, as
> > we are explicitly reporting the rename to the user. It's
> > only the automatic nature of merge-recursive that makes the
> > result confusing. So there's not as much need for caution
> > when just showing a diff.
> 
> The stakes may be different, but doesn't the same justification apply
> anyway?  If "git diff -M" chooses a random pairing to describe a
> renaming of multiple empty files, that seems just as confusing as
> merge-recursive making the same mistake.

Maybe "stakes" was not the best word. My thinking was something like the
following. Matching empty files is a heuristic. So sometimes it will be
right, and sometimes it will be wrong. We want to make sure that the
confusion caused by being wrong is less than the goodness caused by
being right.  When we find renames for a merge, the badness in being
wrong is quite high. And the lack of goodness in failing to be right is
not all that high; you'll get a conflict which will bring the issue to
the user's attention, and they can fall back to using "git diff" to
investigate the situation.

Whereas with a regular diff, the badness of being wrong is not very
high. The user sees the diff and says "Really? Stupid git, that wasn't a
rename". And the lack of goodness in failing to be right is somewhat
worse, because there is no way to fall back and ask git "what renames
would you have found if you relaxed the heuristics a bit more?"

Of course, one could make that fallback an option. And given that we
are, by definition, talking about trivial empty files, it's not like the
rename detection somehow makes the diff a whole lot nicer. It just says
"rename X to Y" instead of "deleted Y, added X". The real value in the
rename detection is seeing the interdiff between X and Y, but it would
always be empty in this case anyway.

So I could go either way.

> If adding this check in diffcore is more complicated, doing it in
> merge-recursive for now seems fine and prudent, but if we are doing it
> at the merge-recursive level just to be conservative then that seems
> like the wrong layer.

It's not really more complicated, and based on Junio's response, I think
we want to do it there anyway. Doing it unconditionally for diff and
merge actually would make the code even simpler, then.

-Peff

  reply	other threads:[~2012-03-22 21:54 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-21 10:28 Strange effect merging empty file Ralf Nyren
2012-03-21 10:54 ` Zbigniew Jędrzejewski-Szmek
2012-03-21 17:14   ` Junio C Hamano
2012-03-22 12:17   ` Randal L. Schwartz
2012-03-22 12:39     ` Ralf Nyren
2012-03-22 12:47     ` Zbigniew Jędrzejewski-Szmek
2012-03-22 14:01       ` Jeff King
2012-03-22 17:03         ` Junio C Hamano
2012-03-22 17:59           ` Jeff King
2012-03-22 18:25             ` Jeff King
2012-03-22 18:52               ` Jeff King
2012-03-22 18:53                 ` [PATCH 1/3] drop casts from users EMPTY_TREE_SHA1_BIN Jeff King
2012-03-22 18:53                 ` [PATCH 2/3] make is_empty_blob_sha1 available everywhere Jeff King
2012-03-22 18:53                 ` [PATCH 3/3] merge-recursive: don't detect renames from empty files Jeff King
2012-03-22 19:18                   ` Jonathan Nieder
2012-03-22 21:53                     ` Jeff King [this message]
2012-03-22 18:52               ` Strange effect merging empty file Junio C Hamano
2012-03-22 19:03                 ` Jeff King
2012-03-22 19:12                   ` Junio C Hamano
2012-03-22 22:46                     ` [PATCH 0/2] merging renames of empty files Jeff King
2012-03-22 22:52                       ` [PATCH 1/2] teach diffcore-rename to optionally ignore empty content Jeff King
2012-03-22 22:52                       ` [PATCH 2/2] merge-recursive: don't detect renames of empty files Jeff King
2012-03-22 23:37                       ` [PATCH 0/2] merging " Junio C Hamano
2012-03-23  0:23                         ` Jeff King
2012-03-23  4:56                           ` Junio C Hamano

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=20120322215355.GA750@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=merlyn@stonehenge.com \
    --cc=ralf.nyren@ericsson.com \
    --cc=zbyszek@in.waw.pl \
    /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).