Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: git@vger.kernel.org
Subject: Re: Instituting feature and infrastructure enhancement proposal window?
Date: Sun, 24 Feb 2008 17:37:15 -0800	[thread overview]
Message-ID: <7vir0dsto4.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <alpine.LFD.1.00.0802241226340.21332@woody.linux-foundation.org> (Linus Torvalds's message of "Sun, 24 Feb 2008 12:42:47 -0800 (PST)")

Linus Torvalds <torvalds@linux-foundation.org> writes:

> And on exactly that note:
>
>>  * diff --dirstat (Linus)
>
> I actually actively use this (not just for -rc releases, but I find it 
> nice to do occasionally in other cases too), so it would be really nice if 
> at least the initial version got merged soon. Even if it gets the binary 
> case wrong,...

I am planning to do this (dropping the "damange" one I
previously showed and queued in 'pu') and merge to 'master' for
now.

-- >8 --
[PATCH] diff --dirstat: saner handling of binary and unmerged files

We do not account binary nor unmerged files when --shortstat is
asked for (or the summary stat at the end of --stat).  

The new option --dirstat should work the same way as it is about
summarizing the changes of multiple files by adding them up.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 diff.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/diff.c b/diff.c
index dd374d4..bcc323f 100644
--- a/diff.c
+++ b/diff.c
@@ -1016,7 +1016,10 @@ static long gather_dirstat(struct diffstat_dir *dir, unsigned long changed, cons
 			this = gather_dirstat(dir, changed, f->name, newbaselen);
 			sources++;
 		} else {
-			this = f->added + f->deleted;
+			if (f->is_unmerged || f->is_binary)
+				this = 0;
+			else
+				this = f->added + f->deleted;
 			dir->files++;
 			dir->nr--;
 			sources += 2;
@@ -1053,6 +1056,8 @@ static void show_dirstat(struct diffstat_t *data, struct diff_options *options)
 	/* Calculate total changes */
 	changed = 0;
 	for (i = 0; i < data->nr; i++) {
+		if (data->files[i]->is_binary || data->files[i]->is_unmerged)
+			continue;
 		changed += data->files[i]->added;
 		changed += data->files[i]->deleted;
 	}

  parent reply	other threads:[~2008-02-25  1:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-24 19:33 Instituting feature and infrastructure enhancement proposal window? Junio C Hamano
2008-02-24 20:42 ` Linus Torvalds
2008-02-25  0:52   ` Shawn O. Pearce
2008-02-25  1:37   ` Junio C Hamano [this message]
2008-02-25  3:25 ` Daniel Barkalow

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=7vir0dsto4.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=torvalds@linux-foundation.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