Re: [PATCH] Correct singular form in diff summary line for human interaction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 31, 2012 at 07:04:15PM -0800, Junio C Hamano wrote:
> Thomas Dickey <dickey@xxxxxxx> 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@xxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxx>
http://invisible-island.net
ftp://invisible-island.net

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]