# [PATCH] Fixed pluralization in diff reports

5 messages from 2011-08-01 to 2011-08-01. Participants: Jon Forrest, Junio C Hamano.
Thread: https://gitlist.dev/t/27973

## Jon Forrest, 2011-08-01 04:00

Subject: [PATCH] Fixed pluralization in diff reports
Message-ID: <4E3624F9.7070406@gmail.com>
URL: https://gitlist.dev/e/4E3624F9.7070406%40gmail.com

```
I got irritated by the

	 1 files changed, 0 insertions(+), 1 deletions(-)

lack of pluralization so I fixed it. Now it says

	 1 file changed, 0 insertions(+), 1 deletion(-)

and so forth.

Signed-off-by: Jon Forrest <nobozo@gmail.com>
---
  diff.c |   10 ++++++----
  1 file changed, 6 insertions(+), 4 deletion(-)

diff --git a/diff.c b/diff.c
index 93ef9a2..a179b24 100644
--- a/diff.c
+++ b/diff.c
@@ -1465,8 +1465,9 @@ static void show_stats(struct diffstat_t *data, 
struct diff_options *options)
  	}
  	fprintf(options->file, "%s", line_prefix);
  	fprintf(options->file,
-	       " %d files changed, %d insertions(+), %d deletions(-)\n",
-	       total_files, adds, dels);
+	       " %d file%s changed, %d insertion%s(+), %d deletion%s(-)\n",
+	       total_files, total_files == 1 ? "" : "s", adds, adds == 1 ? "" 
: "s", dels,
+		dels == 1 ? "" : "s");
  }

  static void show_shortstats(struct diffstat_t *data, struct 
diff_options *options)
@@ -1496,8 +1497,9 @@ static void show_shortstats(struct diffstat_t 
*data, struct diff_options *option
  				options->output_prefix_data);
  		fprintf(options->file, "%s", msg->buf);
  	}
-	fprintf(options->file, " %d files changed, %d insertions(+), %d 
deletions(-)\n",
-	       total_files, adds, dels);
+	fprintf(options->file, " %d file%s changed, %d insertion%s(+), %d 
deletion%s(-)\n",
+	       total_files, total_files == 1 ? "" : "s", adds, adds == 1 ? "" 
: "s", dels,
+		dels == 1 ? "" : "s");
  }

  static void show_numstat(struct diffstat_t *data, struct diff_options 
*options)
-- 1.7.6.347.g4db0d.dirty

```

## Junio C Hamano, 2011-08-01 04:09

Subject: Re: [PATCH] Fixed pluralization in diff reports
Message-ID: <7v8vrdkc19.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v8vrdkc19.fsf%40alter.siamese.dyndns.org
In-Reply-To: <4E3624F9.7070406@gmail.com>

```
Jon Forrest <nobozo@gmail.com> writes:

> I got irritated by the
>
> 	 1 files changed, 0 insertions(+), 1 deletions(-)

This is how the other diff implementation has always showed this line, no?

```

## Jon Forrest, 2011-08-01 04:11

Subject: Re: [PATCH] Fixed pluralization in diff reports
Message-ID: <4E36277B.9020208@gmail.com>
URL: https://gitlist.dev/e/4E36277B.9020208%40gmail.com
In-Reply-To: <7v8vrdkc19.fsf@alter.siamese.dyndns.org>

```
On 7/31/2011 9:09 PM, Junio C Hamano wrote:
> Jon Forrest<nobozo@gmail.com>  writes:
>
>> I got irritated by the
>>
>> 	 1 files changed, 0 insertions(+), 1 deletions(-)
>
> This is how the other diff implementation has always showed this line, no?

Maybe, but it's not grammatical English no matter who does it.

But, I'm in the process of asking you to disregard this change
because I noticed that the diff of my change to diff.c was

	1 file changed, 6 insertions(+), 4 deletion(-)

The last part is clearly wrong, but I don't see why
my change didn't work. It's such a simple change.

Back to the drawing board.

Sorry for the bother.

Jon

```

## Junio C Hamano, 2011-08-01 05:06

Subject: Re: [PATCH] Fixed pluralization in diff reports
Message-ID: <7v4o21k9e9.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v4o21k9e9.fsf%40alter.siamese.dyndns.org
In-Reply-To: <4E36277B.9020208@gmail.com>

```
Jon Forrest <nobozo@gmail.com> writes:

>> This is how the other diff implementation has always showed this line, no?
>
> Maybe, but it's not grammatical English no matter who does it.

It does not matter it is grammatical or not; changing it would break
expectation by scripts that are used to the output both by the other
implementation and by us.

```

## Jon Forrest, 2011-08-01 05:09

Subject: Re: [PATCH] Fixed pluralization in diff reports
Message-ID: <4E363503.6050102@gmail.com>
URL: https://gitlist.dev/e/4E363503.6050102%40gmail.com
In-Reply-To: <7v4o21k9e9.fsf@alter.siamese.dyndns.org>

```
On 7/31/2011 10:06 PM, Junio C Hamano wrote:
> Jon Forrest<nobozo@gmail.com>  writes:
>
>>> This is how the other diff implementation has always showed this line, no?
>>
>> Maybe, but it's not grammatical English no matter who does it.
>
> It does not matter it is grammatical or not; changing it would break
> expectation by scripts that are used to the output both by the other
> implementation and by us.

I see your point. I agree that this change isn't important
enough to disturb so many things. I didn't realize this
would happen.

Sorry,
Jon

```
