git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Carter Lamb <carter.lamb@livetext.com>
Cc: git@vger.kernel.org
Subject: Re: git diff
Date: Mon, 17 Jan 2011 17:30:21 -0500	[thread overview]
Message-ID: <20110117223021.GA31045@sigill.intra.peff.net> (raw)
In-Reply-To: <AANLkTik7cfu_DS=GS5gz_Tu94NC=ZGi-eA8YXztyd9Ra@mail.gmail.com>

On Thu, Jan 13, 2011 at 04:46:16PM -0600, Carter Lamb wrote:

> I use git diff --summary --numstat <commit> to report the files
> modified, created, and deleted between the current commit and some
> prior commit. The --stat and --numstat options count the lines added
> and deleted for each file. Is there a way to report the lines modified
> for each file. For example:

Not really, because it's not well defined. Consider your example:

> Given content below for commit 1:
> aaaaa
> ccccc
> 
> Given content below for commit 2:
> aaaaa
> bbbbb
> ccccc
> 
> Given content below for commit 3:
> Aaaaa
> Bbbbb
> ccccc
> ddddd

How do we know that "Aaaaa" is a modification of line "aaaaa", and not
simply the deletion of the old line and the addition of a new one? It's
easy to come up with a case where that is more obvious:

  -aaaaa
  +ddddd

but there are many shades of gray in between. Is:

  -aaaaa
  +Aaada

the deletion of an old line and the introduction of a new one, or the
modification of an existing line?  So fundamentally the diff format just
deals with added and removed lines, and modifications are represented as
a delete followed by an add.

Which isn't to say you couldn't think of many clever algorithms for
heuristically determining a modification, but git doesn't do that itself
in numstat.

-Peff

  reply	other threads:[~2011-01-17 22:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AANLkTi=ASvicFGaaDfqxjOxJELWPLKsQwvk7rEeT36Fh@mail.gmail.com>
2011-01-13 22:46 ` git diff Carter Lamb
2011-01-17 22:30   ` Jeff King [this message]
2016-10-12 10:50 webmaster
2016-10-12 11:06 ` Mike Rappazzo
2016-10-12 13:51   ` webmaster

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=20110117223021.GA31045@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=carter.lamb@livetext.com \
    --cc=git@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).