All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jon Forrest <nobozo@gmail.com>
To: git@vger.kernel.org, gitster@pobox.com
Subject: [PATCH] For Real - Fixed pluralization in diff reports
Date: Sun, 31 Jul 2011 21:46:06 -0700	[thread overview]
Message-ID: <4E362F8E.1050105@gmail.com> (raw)

[I must have accidentally removed the "s" in "deletions" before.
I just rebuilt everything and remade the patch. All looks well
this time. This is my first submitted patch to anything
so my fingers are still learning.]

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 deletions(-)

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.351.gb35ac.dirty

             reply	other threads:[~2011-08-01  4:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-01  4:46 Jon Forrest [this message]
2011-08-01  4:50 ` [PATCH] For Real - Fixed pluralization in diff reports Nguyen Thai Ngoc Duy
2011-08-01  4:57   ` Jon Forrest
2011-08-01  5:21     ` Nguyen Thai Ngoc Duy
2011-08-01  9:58 ` Sverre Rabbelier
2011-08-01 14:32   ` Jon Forrest
2011-08-01 18:06     ` Jeff King
2011-08-01 18:27       ` Jon Forrest
2011-08-01 18:32         ` Sverre Rabbelier
2011-08-01 18:38           ` Jeff King
2011-08-03 13:38     ` Jakub Narebski
2011-08-03 16:52       ` Jon Forrest

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=4E362F8E.1050105@gmail.com \
    --to=nobozo@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.