Re: [PATCH 1/2] i18n: leave \n out of translated diffstat
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.