From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Matt McCutchen <matt@mattmccutchen.net>, git@vger.kernel.org
Subject: Re: "git diff --ignore-space-change --stat" lists files with only whitespace differences as "changed"
Date: Wed, 18 Jan 2017 12:57:12 -0800 [thread overview]
Message-ID: <xmqqvatc3x3r.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20170118111705.6bqzkklluikda3r5@sigill.intra.peff.net> (Jeff King's message of "Wed, 18 Jan 2017 06:17:05 -0500")
Jeff King <peff@peff.net> writes:
> So I dunno. A sensible rule to me is "iff -p would show a diff header,
> then --stat should mention it".
True but tricky (you need a better definition of "a diff header").
In addition to a new and deleted file, does a file whose executable
bit was flipped need mention? If so, then "diff --git" is the diff
header in the above. Otherwise "@@ ... @@", iow, "iff -p would show
any hunk".
I think the patch implements the latter, which I think is sensible.
> + /*
> + * Omit diffstats where nothing changed. Even if
> + * !same_contents, this might be the case due to ignoring
> + * whitespace changes, etc.
> + *
> + * But note that we special-case additions and deletions,
> + * as adding an empty file, for example, is still of interest.
> + */
> + if (DIFF_FILE_VALID(one) && DIFF_FILE_VALID(two)) {
> + struct diffstat_file *file =
> + diffstat->files[diffstat->nr - 1];
> + if (!file->added && !file->deleted) {
> + free_diffstat_file(file);
> + diffstat->nr--;
> + }
> + }
> }
next prev parent reply other threads:[~2017-01-18 21:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-18 2:01 "git diff --ignore-space-change --stat" lists files with only whitespace differences as "changed" Matt McCutchen
2017-01-18 11:17 ` Jeff King
2017-01-18 20:57 ` Junio C Hamano [this message]
2017-01-18 21:08 ` Jeff King
2017-01-18 22:15 ` Junio C Hamano
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=xmqqvatc3x3r.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=matt@mattmccutchen.net \
--cc=peff@peff.net \
/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).