git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] diff and apply: fix singular/plural grammar nit.
@ 2011-11-27 13:44 David Ripton
  2011-11-27 14:47 ` Jakub Narebski
  0 siblings, 1 reply; 4+ messages in thread
From: David Ripton @ 2011-11-27 13:44 UTC (permalink / raw)
  To: git, gitster

Remove the trailing 's' from "files", "insertions", and "deletions"
when there is only one of the item.

Signed-off-by: David Ripton <dripton@ripton.net>
---
  builtin/apply.c |    5 ++++-
  diff.c          |   13 +++++++++----
  2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/builtin/apply.c b/builtin/apply.c
index 84a8a0b..47bbc23 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -3244,7 +3244,10 @@ static void stat_patch_list(struct patch *patch)
                 show_stats(patch);
         }

-       printf(" %d files changed, %d insertions(+), %d deletions(-)\n", 
files, adds, dels);
+       printf(" %d file%s changed, %d insertion%s(+), %d deletion%s(-)\n",
+              files, (files == 1 ? "" : "s"),
+              adds, (adds == 1 ? "" : "s"),
+              dels, (dels == 1 ? "" : "s"));
  }

  static void numstat_patch_list(struct patch *patch)
diff --git a/diff.c b/diff.c
index 374ecf3..531dcb1 100644
--- a/diff.c
+++ b/diff.c
@@ -1467,8 +1467,10 @@ 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)
@@ -1498,8 +1500,11 @@ 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.8.rc3

-- 
David Ripton    dripton@ripton.net

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] diff and apply: fix singular/plural grammar nit.
  2011-11-27 13:44 [PATCH] diff and apply: fix singular/plural grammar nit David Ripton
@ 2011-11-27 14:47 ` Jakub Narebski
  2011-11-27 14:50   ` Carlos Martín Nieto
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Narebski @ 2011-11-27 14:47 UTC (permalink / raw)
  To: David Ripton; +Cc: git

David Ripton <dripton@ripton.net> writes:

> Remove the trailing 's' from "files", "insertions", and "deletions"
> when there is only one of the item.
> 
> Signed-off-by: David Ripton <dripton@ripton.net>
> ---
[...]
> -       printf(" %d files changed, %d insertions(+), %d
> deletions(-)\n", files, adds, dels);

Whitespace damaged.  Please turn off word wrapping (limiting line
width) when sending patches.

> +       printf(" %d file%s changed, %d insertion%s(+), %d deletion%s(-)\n",
> +              files, (files == 1 ? "" : "s"),
> +              adds, (adds == 1 ? "" : "s"),
> +              dels, (dels == 1 ? "" : "s"));
>   }

First, I think this is an API / plumbing and should not be changed.
But I might be mistaken about that.

Second, it is a perfect example ho to *not* handle plural form in the
presence of internationalization (i18n) efforts.  See e.g.

  http://www.gnu.org/s/hello/manual/gettext/Plural-forms.html

-- 
Jakub Narębski

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] diff and apply: fix singular/plural grammar nit.
  2011-11-27 14:47 ` Jakub Narebski
@ 2011-11-27 14:50   ` Carlos Martín Nieto
  2011-11-27 15:41     ` Frans Klaver
  0 siblings, 1 reply; 4+ messages in thread
From: Carlos Martín Nieto @ 2011-11-27 14:50 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: David Ripton, git

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

On Sun, Nov 27, 2011 at 06:47:21AM -0800, Jakub Narebski wrote:
> David Ripton <dripton@ripton.net> writes:
> 
> > Remove the trailing 's' from "files", "insertions", and "deletions"
> > when there is only one of the item.
> > 
> > Signed-off-by: David Ripton <dripton@ripton.net>
> > ---
> [...]
> > -       printf(" %d files changed, %d insertions(+), %d
> > deletions(-)\n", files, adds, dels);
> 
> Whitespace damaged.  Please turn off word wrapping (limiting line
> width) when sending patches.
> 
> > +       printf(" %d file%s changed, %d insertion%s(+), %d deletion%s(-)\n",
> > +              files, (files == 1 ? "" : "s"),
> > +              adds, (adds == 1 ? "" : "s"),
> > +              dels, (dels == 1 ? "" : "s"));
> >   }
> 
> First, I think this is an API / plumbing and should not be changed.
> But I might be mistaken about that.

I think somebody already tried to do this not too long ago (don't know
if there as a patch) but the diffstat tool always uses the plural, and
it might break scripts.

   cmn



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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] diff and apply: fix singular/plural grammar nit.
  2011-11-27 14:50   ` Carlos Martín Nieto
@ 2011-11-27 15:41     ` Frans Klaver
  0 siblings, 0 replies; 4+ messages in thread
From: Frans Klaver @ 2011-11-27 15:41 UTC (permalink / raw)
  To: Jakub Narebski, Carlos Martín Nieto; +Cc: David Ripton, git

On Sun, 27 Nov 2011 15:50:33 +0100, Carlos Martín Nieto <cmn@elego.de>  
wrote:

> I think somebody already tried to do this not too long ago (don't know
> if there as a patch) but the diffstat tool always uses the plural, and
> it might break scripts.

That would be http://thread.gmane.org/gmane.comp.version-control.git/178316

Frans

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-11-27 15:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-27 13:44 [PATCH] diff and apply: fix singular/plural grammar nit David Ripton
2011-11-27 14:47 ` Jakub Narebski
2011-11-27 14:50   ` Carlos Martín Nieto
2011-11-27 15:41     ` Frans Klaver

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).