Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [BUG] git-am silently applying patches incorrectly

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:50:43
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

Junio C Hamano [off-list ref] writes:
In any case, here is an update to match what GNU patch seems to do more
closely.
...
This is an unrelated tangent, but in a separate thread there was a
discussion on "%d noun(s)" in a recent weatherbaloon patch, and use of
ngettext(3) was suggested to solve this portably to languages other than
Germanic and Romanic family.

So here is my exercise for preparing the new code for upcoming i18n.
Does it look sane?

Do we want a new wrapper similar to _() that would easily make this into a
noop under NO_GETTEXT in the proposed i18n infrastructure?

 builtin/apply.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index a231c0c..f084250 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -2644,7 +2644,10 @@ static int apply_one_fragment(struct image *img, struct fragment *frag,
 			if (apply_in_reverse)
 				offset = 0 - offset;
 			fprintf(stderr,
+				ngettext(
+				"Hunk #%d succeeded at %d (offset %d line).\n",
 				"Hunk #%d succeeded at %d (offset %d lines).\n",
+				(offset < 0 ? (0 - offset) : offset)),
 				nth_fragment, applied_pos + 1, offset);
 		}
 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help