git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Dickey <dickey@his.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: dickey@his.com, "Nguyen Thai Ngoc Duy" <pclouds@gmail.com>,
	"Jonathan Nieder" <jrnieder@gmail.com>,
	git@vger.kernel.org, "Ævar Arnfjörð" <avarab@gmail.com>,
	"Frederik Schwarzer" <schwarzerf@gmail.com>,
	"Brandon Casey" <drafnel@gmail.com>,
	dickey@invisible-island.net
Subject: Re: [PATCH] Correct singular form in diff summary line for human interaction
Date: Wed, 01 Feb 2012 04:40:06 -0500	[thread overview]
Message-ID: <20120201094006.GA3989@debian50-32.invisible-island.net> (raw)
In-Reply-To: <7vk4475k5s.fsf@alter.siamese.dyndns.org>

[-- Attachment #1: Type: text/plain, Size: 3686 bytes --]

On Tue, Jan 31, 2012 at 07:04:15PM -0800, Junio C Hamano wrote:
> Thomas Dickey <dickey@his.com> writes:
> 
> > On Wed, Feb 01, 2012 at 08:32:43AM +0700, Nguyen Thai Ngoc Duy wrote:
> >> On Wed, Feb 1, 2012 at 12:50 AM, Junio C Hamano <gitster@pobox.com> wrote:
> >> >> If there is an environment variable to say "I don't want to see
> >> >> variations on strings intended for humans", can it be spelled as
> >> >> LC_ALL=C?
> >> >
> >> >  ...
> >
> > ... diffstat (google helped find context)
> 
> When we show diffstat from "git diff --stat" (or "git apply --stat"), we
> currently do not do any singular/plural on the last line of the output
> that summarizes the graph, ending up with:
> 
> 	1 files changed, 1 insertions(+), 0 deletions(-)
> 
> when there is a single line insertion to a file and nothing else.
> 
> My recollection is that our behaviour originally came from our desire to
> be as close as what "diffstat" produces, but that does not seem to be the
> case.  I observed that the output from recent versions of "diffstat" is
> much more human friendly.  We get these, depending on the input, from
> "diffstat" version 1.53:

I added the PLURAL() macro in 1.22, in 1996/3/16, which was a few months
before Tony Nugent commented that it was being used by other people.  Since
I'd been sending patches with diffstat's since mid-1994, it's possible
that there were a few copies using the form without plurals.  But it's
been quite a while.  Also, it was in 1998/1/17 that I modified the
copyright notice (1.26) at the request of someone in the Linux group, so
I'd assume that they would have started using the newer version.

Except for later applying PLURAL to the number of files changed (which Jean
Delvare pointed out in 2005), the message construction has not changed since
then.  The insert/delete/modify parts of the message were optional as you see in
my earliest version (1.3) from 1993/10/23:

	printf("%d files changed", num_files);
	if (total_ins) printf(", %d insertions", total_ins);
	if (total_del) printf(", %d deletions", total_del);
	if (total_mod) printf(", %d modifications", total_mod);
	printf("\n");
 
>         1 file changed, 1 insertion(+)
>         1 file changed, 1 deletion(-)
> 	0 files changed
> 	2 files changed, 3 insertions(+), 1 deletion(-)
> 
> Namely, it does singular/plural correctly, and omits unnecessary "0
> deletions(-)" and "0 insertions(+)".
> 
> I was wondering if you remember what the behaviour of older versions of
> "diffstat" was, and if it was changed to be more human friendly over
> time. It is very possible that I am misremembering this and "diffstat" has
> always done the singular/plural correctly and omitted useless "0 lines".

I have back to 1.3 in my archive. I use rcshist to look for things like this.
(also, for small things like this, I have a script that pulls all versions,
with proper timestamps to make it simpler to sort the files by date).
 
> Somehow it seems hard to get hold of older versions of "diffstat", and I
> was hoping that I could get that information straight out of the current
> maintainer.

I can provide the information.

Actually a couple of weeks ago I was experimenting with rcs-fast-export, but
found that would need more work to export diffstat (I use branches a lot)
I'm using "conflict" as a test-case for the changes that I'm making to support
exporting mawk.

> Thanks for responding and sorry for the lack of context of the original
> message.

no problem - google was helpful ;-)

-- 
Thomas E. Dickey <dickey@invisible-island.net>
http://invisible-island.net
ftp://invisible-island.net

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2012-02-01  9:40 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-31 14:24 [PATCH] Correct singular form in diff summary line for human interaction Nguyễn Thái Ngọc Duy
2012-01-31 15:20 ` Jonathan Nieder
2012-01-31 17:50   ` Junio C Hamano
2012-02-01  1:32     ` Nguyen Thai Ngoc Duy
2012-02-01  1:45       ` Thomas Dickey
2012-02-01  1:56       ` Thomas Dickey
2012-02-01  2:37         ` Nguyen Thai Ngoc Duy
2012-02-01  3:04         ` Junio C Hamano
2012-02-01  9:40           ` Thomas Dickey [this message]
2012-02-01 12:55 ` [PATCH v2] Use correct grammar in diffstat summary line Nguyễn Thái Ngọc Duy
2012-02-01 21:26   ` Junio C Hamano
2012-02-02 14:22     ` Nguyen Thai Ngoc Duy
2012-02-02 18:24       ` Junio C Hamano
2012-02-03  1:11         ` Nguyen Thai Ngoc Duy
2012-02-03  1:18           ` Junio C Hamano
2012-02-03 12:24           ` Jeff King
2012-02-01 23:35   ` Jonathan Nieder
2012-02-02  0:20     ` [RFC/PATCH] i18n: do not define gettext/ngettext in NO_GETTEXT case Jonathan Nieder
2012-02-02  0:27     ` [PATCH v2] Use correct grammar in diffstat summary line Jonathan Nieder
2012-02-02  0:31     ` Jonathan Nieder
2012-03-13  4:51   ` [RFC/PATCH 0/7] tests: diffstat summary line varies by locale (Re: [PATCH v2] Use correct grammar in diffstat summary line) Jonathan Nieder
2012-03-13  4:54     ` [PATCH 1/7] test: use test_i18ncmp when checking --stat output Jonathan Nieder
2012-03-13  6:00       ` Junio C Hamano
2012-03-13  6:05         ` Junio C Hamano
2012-03-13  6:13           ` Jonathan Nieder
2012-03-13  6:06         ` Jonathan Nieder
2012-03-13  4:58     ` [PATCH 2/7] test: use numstat instead of diffstat in funny-names test Jonathan Nieder
2012-03-13  4:59     ` [PATCH 3/7] test: modernize funny-names test style Jonathan Nieder
2012-03-13  5:00     ` [PATCH 4/7] test: test cherry-pick functionality and output separately Jonathan Nieder
2012-03-13  5:01     ` [PATCH 5/7] test: use --numstat instead of --stat in "git stash show" tests Jonathan Nieder
2012-03-13  5:02     ` [PATCH 6/7] test: use numstat instead of diffstat in binary-diff test Jonathan Nieder
2012-03-13  5:05     ` [PATCH 7/7] diffstat summary line varies by locale: miscellany Jonathan Nieder

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=20120201094006.GA3989@debian50-32.invisible-island.net \
    --to=dickey@his.com \
    --cc=avarab@gmail.com \
    --cc=dickey@invisible-island.net \
    --cc=drafnel@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=pclouds@gmail.com \
    --cc=schwarzerf@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).