git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "Mart Sõmermaa" <mrts.pydev@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	Michael J Gruber <git@drmicha.warpmail.net>,
	git@vger.kernel.org
Subject: Re: git diff: add option for omitting the contents of deletes
Date: Tue, 8 Mar 2011 16:31:34 -0500	[thread overview]
Message-ID: <20110308213133.GA5786@sigill.intra.peff.net> (raw)
In-Reply-To: <AANLkTim9juvhBJKraHBkV8AC=zY75xt_1BnyhTDTcoUZ@mail.gmail.com>

On Tue, Mar 08, 2011 at 11:25:04PM +0200, Mart Sõmermaa wrote:

> "It also might make sense to apply the similar principle to shorten the output
> with -B when a rewrite patch is expressed as a single hunk patch that removes
> everything old and then adds everthing new."
> 
> I have to admit that I've never used -B, only -M, so please don't mind that
> its semantics and exact behavior are a bit foreign to me.
> 
> After running t/t4130-apply-criss-cross-rename.sh,
> `git diff -M -B` outputs the following:
> 
> diff --git a/file2 b/file1
> similarity index 100%
> rename from file2
> rename to file1
> diff --git a/file1 b/file2
> similarity index 100%
> rename from file1
> rename to file2
> 
> Can you bring a similar example of changes in the output after
> the above-mentioned similar principle has been implemented for -B?

Try:

  $ git init
  $ perl -e 'print "a\n" for (1 .. 1000)' >file
  $ git add file && git commit -m one
  $ perl -e 'print "b\n" for (1 .. 1000)' >file

Now you can see that -B breaks notes it as a rewrite:

  $ git diff --stat --summary -B
   file | 2000 +++++++++++++++++++++++++++----------------------------
   1 files changed, 1000 insertions(+), 1000 deletions(-)
   rewrite file (100%)

And the diff is long:

  $ git diff -B
  diff --git a/file b/file
  dissimilarity index 100%
  index 5cfafaa..a7b871a 100644
  --- a/file
  +++ b/file
  @@ -1,1000 +1,1000 @@
  -a
  -a
  [... x 1000]
  +b
  +b
  [... x 1000]

But we could perhaps drop the actual 1000-line hunks (or maybe even just
the deletion half).

-Peff

  reply	other threads:[~2011-03-08 21:31 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-26 13:16 git diff: add option for omitting the contents of deletes Mart Sõmermaa
2011-02-26 20:11 ` Junio C Hamano
2011-02-27 14:41   ` Michael J Gruber
2011-02-27 22:33     ` Mart Sõmermaa
2011-02-28  9:58       ` Michael J Gruber
2011-02-28 10:51         ` Mart Sõmermaa
2011-02-27 22:54     ` Junio C Hamano
2011-02-27 23:07       ` Junio C Hamano
2011-02-28  7:31         ` Michael J Gruber
2011-02-28 12:17           ` Jeff King
2011-02-28 12:23             ` Jeff King
2011-02-28 12:32               ` Michael J Gruber
2011-02-28 12:59                 ` Jeff King
2011-02-28 13:05                   ` Michael J Gruber
2011-02-28 21:54                     ` Jeff King
2011-02-28 18:11               ` Junio C Hamano
2011-02-28 22:23                 ` Jeff King
2011-02-28 23:28                   ` Junio C Hamano
2011-03-01  0:11                     ` Junio C Hamano
2011-03-07 20:38                       ` Mart Sõmermaa
2011-03-08  7:14                         ` Michael J Gruber
2011-03-08 19:49                         ` Junio C Hamano
2011-03-08 21:25                           ` Mart Sõmermaa
2011-03-08 21:31                             ` Jeff King [this message]
2011-02-28 12:42             ` symling diff driver (Was: Re: git diff: add option for omitting the contents of deletes) Michael J Gruber
2011-02-28 13:08               ` Jeff King
2011-02-28 15:26                 ` [PATCH/WIP] attr: make attributes depend on file type Michael J Gruber
2011-02-28 17:30                   ` Jeff King
2011-02-28 17:48                     ` Junio C Hamano
2011-03-01  7:46                       ` Michael J Gruber
2011-02-28 10:45         ` git diff: add option for omitting the contents of deletes Mart Sõmermaa
2011-02-28 16:10           ` Michael J Gruber

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=20110308213133.GA5786@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mrts.pydev@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).