git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "Michał Kiedrowicz" <michal.kiedrowicz@gmail.com>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Sverre Rabbelier <srabbelier@gmail.com>,
	Junio C Hamano <gitster@pobox.com>,
	Anders Melchiorsen <mail@cup.kalibalik.dk>,
	Tuncer Ayaz <tuncer.ayaz@gmail.com>,
	git@vger.kernel.org
Subject: Re: correct git merge behavior or corner case?
Date: Tue, 21 Apr 2009 15:11:26 -0400	[thread overview]
Message-ID: <20090421191126.GA7632@coredump.intra.peff.net> (raw)
In-Reply-To: <20090421204701.1e0115c0@gmail.com>

On Tue, Apr 21, 2009 at 08:47:01PM +0200, Michał Kiedrowicz wrote:

> > I thought the point was about _empty_ renames. This is a small but
> > non-zero rename.
> 
> Yes, you are right. But change these echos to touch and you'll see that
> this bug happens if date and LICENSE are the same, not necessary empty.

Right, because it is not exactly a bug, as I explained here:

  http://article.gmane.org/gmane.comp.version-control.git/117078

I say "not exactly a bug", because it is working as intended by the
software authors, but because the intended behavior is to make a
heuristic guess (some content moved from one filename to another, so we
guess that a patch against the original content should actually go
against the new location), the guess may not follow the user's
expectations.

It is easy to see how the heuristic can be fooled in a toy example. But
what we really care about is whether and how the heuristic is fooled in
the real world.  In the real world, there seems to be some non-trivial
probability of removing an empty file, adding a new one elsewhere, and
then merging with somebody who touched the empty file. So it may be
worth improving the heuristic for this special case, especially because
the harm done in a false negative is relatively small.

But what is the probability of doing the same thing to a file that has
non-trivial contents? I would guess it is much less likely, and by
special-casing it as a conflict, you have a much higher chance of
bothering users who were relying on actual rename detection for their
non-trivial case[1]. Of course, I don't have actual numbers, so I'm just
guessing.

So my point is that while both are perhaps a failing of the heuristic,
only one is going to be worth tweaking the heuristic for. So that is the
one that should be included in the test case, since it is how somebody
implementing a proposed tweak can test their tweak.

-Peff

[1] On a side note, this got me thinking about how git handles rename
detection during merging. One of the things I like about git is that it
tries to be very stupid: if something is questionable during a merge, it
calls attention to it and makes it _easy_ for the user to access the
versions and resolve (and I love mergetool for this). But renames are
not like this: either they happen during auto-conflict-resolution, or
they don't. I wonder if it might be a better strategy to barf on
conflicts due removed files that could be resolved by questionable
renames, but have a post-merge "renametool" that shows the user
potential renames and lets them interactively specify the resolution.
But maybe that would just be annoying, since 99% of the time, the rename
detection gets it right.

  reply	other threads:[~2009-04-21 19:13 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-19 22:40 correct git merge behavior or corner case? Tuncer Ayaz
2009-04-20  3:19 ` Shawn O. Pearce
2009-04-20  9:49 ` Johannes Schindelin
2009-04-20 10:10   ` Anders Melchiorsen
2009-04-21  2:44     ` Jeff King
2009-04-21  2:51       ` Jeff King
2009-04-21  3:09       ` Junio C Hamano
2009-04-21  8:48         ` Sverre Rabbelier
2009-04-21  8:56           ` Johannes Schindelin
2009-04-21  9:00             ` Sverre Rabbelier
2009-04-21  9:04               ` Johannes Schindelin
2009-04-21  9:01             ` Johannes Schindelin
2009-04-21 17:27               ` Michał Kiedrowicz
2009-04-21 17:54               ` Michał Kiedrowicz
2009-04-21 18:05                 ` Jeff King
2009-04-21 18:47                   ` Michał Kiedrowicz
2009-04-21 19:11                     ` Jeff King [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-04-20 14:50 François Beausoleil
2009-04-21 19:27 ` Jeff King

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=20090421191126.GA7632@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mail@cup.kalibalik.dk \
    --cc=michal.kiedrowicz@gmail.com \
    --cc=srabbelier@gmail.com \
    --cc=tuncer.ayaz@gmail.com \
    /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).