git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Michael J Gruber <git@grubix.eu>
Cc: Joan Aguilar <joan.aguilar.lorente@gmail.com>, git@vger.kernel.org
Subject: Re: report on a possible bug: git commit -p myfile.py unexpected output
Date: Fri, 24 Mar 2017 11:09:21 -0400	[thread overview]
Message-ID: <20170324150921.vwh4yqpz25ph3zxe@sigill.intra.peff.net> (raw)
In-Reply-To: <26915be5-8749-7f66-4d60-516e7ed60adc@grubix.eu>

On Fri, Mar 24, 2017 at 03:59:07PM +0100, Michael J Gruber wrote:

> > [master 96d1c24] myfile.py -> old unused methods removed...
> >  1 file changed, 182 insertions(+), 302 deletions(-)
> >  rewrite myfile.py (60%)
> [...]
> > myfile.py | 120
> > ---------------------------------------------------------------------------------------------------------------------
> > 1 file changed, 120 deletions(-)
> 
> 182-302 = -120
> 
> Did you make any changes in the lines that you left? Apparantly, that's
> what the rewrite looked like to git commit.

Even without changes to the remaining lines, a rewrite diff would
consider them removed from the preimage and added again in the
post-image.

The difference between the two commands is that "commit" turns on "-B"
break detection by default, and "git show", "tig", etc, do not.

Looking at the actual diff with "git show -B" should show something
like:

  -old
  -lines
  -that
  -weren't
  -touched
  -some
  -lines
  -that
  -were
  -deleted
  +old
  +lines
  +that
  +weren't
  +touched

The change is the same no matter how you view it; the "-B" flag just
asks Git to show a non-minimal diff when the file was substantially
changed.

-Peff

  reply	other threads:[~2017-03-24 15:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-24 10:27 report on a possible bug: git commit -p myfile.py unexpected output Joan Aguilar
2017-03-24 14:59 ` Michael J Gruber
2017-03-24 15:09   ` Jeff King [this message]
2017-03-24 15:31     ` Joan Aguilar
2017-03-24 15:52       ` 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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20170324150921.vwh4yqpz25ph3zxe@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@grubix.eu \
    --cc=git@vger.kernel.org \
    --cc=joan.aguilar.lorente@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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).