Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Mike Hommey <mh@glandium.org>
Cc: git@vger.kernel.org
Subject: Re: Counter-intuitive result from diff -C --stat
Date: Sat, 31 Dec 2016 17:15:43 -0800	[thread overview]
Message-ID: <xmqqd1g760n4.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20161228080916.72id4hzqxfbygtth@glandium.org> (Mike Hommey's message of "Wed, 28 Dec 2016 17:09:16 +0900")

Mike Hommey <mh@glandium.org> writes:

> Hi,
>
> So I was checking out differences between two branches, accounting for
> file moves with -C, and was surprised by the number of insertions and
> deletions that it indicated, because it was telling me I had removed
> more than I added, which I really don't think is true.
>
> I took a closer look, and what happens is that I had a lot of stuff in
> a __init__.py file that I moved to another file, while keeping a now
> new, empty, __init__.py file.
>
> Which means while diff counts the deletions from __init__.py, it doesn't
> count the additions from the move because it is a move, leading to a
> counter-intuitive result.

Intuition is in the eyes of observer.  

A pairing of the original and the result you saw might be not very
useful (which I have no opinion on), but in the context of the
chosen pairing of the original and the result, in order to produce
the final result, you started from a copy of the original and
removed quite a lot while adding just a bit, so what you saw was an
outcome that was deliberately designed.


      reply	other threads:[~2017-01-01  1:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-28  8:09 Counter-intuitive result from diff -C --stat Mike Hommey
2017-01-01  1:15 ` 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:
  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=xmqqd1g760n4.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=mh@glandium.org \
    /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