git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/2] i18n: leave \n out of translated diffstat

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jun 25, 2012, 11:33 UTC
Message-ID
<20120625113328.GA9270@burratino>
In-Reply-To
<CACsJy8De_Toy+7jvsBueYZpcuakTxZupmwLYZVm29Ni3+1QuMw@mail.gmail.com>
Nguyen Thai Ngoc Duy wrote:
> That prints "0 files changed, 0 insertions(+), 0 deletions(-)" instead
> of "0 files changed". Two more changed lines to make it the latter.
Sloppy of me.  Yes, I meant
diff --git i/diff.c w/diff.c
index 1a594df4..287f310d 100644
--- i/diff.c
+++ w/diff.c
@@ -1395,11 +1395,6 @@ int print_stat_summary(FILE *fp, int files, int insertions, int deletions)
 	struct strbuf sb = STRBUF_INIT;
 	int ret;
 
-	if (!files) {
-		assert(insertions == 0 && deletions == 0);
-		return fputs(_(" 0 files changed\n"), fp);
-	}
-
 	strbuf_addf(&sb,
 		    Q_(" %d file changed", " %d files changed", files),
 		    files);
@@ -1412,7 +1407,7 @@ int print_stat_summary(FILE *fp, int files, int insertions, int deletions)
 	 * is probably less confusing (i.e skip over "2 files changed
 	 * but nothing about added/removed lines? Is this a bug in Git?").
 	 */
-	if (insertions || deletions == 0) {
+	if (insertions || (files && deletions == 0)) {
 		/*
 		 * TRANSLATORS: "+" in (+) is a line addition marker;
 		 * do not translate it.
@@ -1423,7 +1418,7 @@ int print_stat_summary(FILE *fp, int files, int insertions, int deletions)
 			    insertions);
 	}
 
-	if (deletions || insertions == 0) {
+	if (deletions || (files && insertions == 0)) {
 		/*
 		 * TRANSLATORS: "-" in (-) is a line removal marker;
 		 * do not translate it.
Previous: Nguyen Thai Ngoc Duy
Message 11 of 11 in “i18n: leave \n out of translated diffstat”
  1. 1/2 i18n: leave \n out of translated diffstatNguyễn Thái Ngọc Duy, Jun 24, 2012
  2. 2/2 Add C_LOCALE_OUTPUT prereq to test cases that require English text matchingNguyễn Thái Ngọc Duy, Jun 24, 2012
  3. Jonathan NiederJun 24, 2012
  4. Nguyen Thai Ngoc DuyJun 25, 2012
  5. Jonathan NiederJun 25, 2012
  6. Nguyen Thai Ngoc DuyJun 25, 2012
  7. Jonathan NiederJun 25, 2012
  8. Jonathan NiederJun 24, 2012
  9. Junio C HamanoJun 25, 2012
  10. Nguyen Thai Ngoc DuyJun 25, 2012
  11. Jonathan NiederJun 25, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.