From: Junio C Hamano <gitster@pobox•com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail•com>,
"Jonathan Nieder" <jrnieder@gmail•com>
Cc: git@vger•kernel.org
Subject: Re: [BUG] git-am silently applying patches incorrectly
Date: Sun, 06 Mar 2011 14:40:05 -0800 [thread overview]
Message-ID: <7vhbbf50vu.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <7vsjuz520w.fsf@alter.siamese.dyndns.org> (Junio C. Hamano's message of "Sun\, 06 Mar 2011 14\:15\:27 -0800")
Junio C Hamano <junio@pobox•com> writes:
> ...
> 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);
> }
>
If we were to do i18n, we would probably need to include something like
the following in the early fast-tracked part of the series, perhaps as
part of the e6bb27e (i18n: add no-op _() and N_() wrappers, 2011-02-22)
gettext.h | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/gettext.h b/gettext.h
index 6949d73..1510c5d 100644
--- a/gettext.h
+++ b/gettext.h
@@ -23,4 +23,10 @@ static inline FORMAT_PRESERVING(1) const char *_(const char *msgid)
/* Mark msgid for translation but do not translate it. */
#define N_(msgid) (msgid)
+static inline const char *ngettext(const char *msgid, const char *plu, unsigned long n)
+{
+ /* fallback ngettext() without using libintl */
+ return (n == 1) ? msgid : plu;
+}
+
#endif
next prev parent reply other threads:[~2011-03-06 22:40 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-04 13:40 [BUG] git-am silently applying patches incorrectly Colin Guthrie
2011-03-04 16:17 ` Drew Northup
2011-03-04 16:41 ` Colin Guthrie
2011-03-04 17:27 ` Junio C Hamano
2011-03-04 17:49 ` Junio C Hamano
2011-03-04 18:37 ` Junio C Hamano
2011-03-04 19:05 ` Junio C Hamano
2011-03-04 19:18 ` Linus Torvalds
2011-03-04 19:31 ` Junio C Hamano
2011-03-04 20:14 ` Alexander Miseler
2011-03-04 21:33 ` Junio C Hamano
2011-03-04 22:20 ` Colin Guthrie
2011-03-04 22:34 ` Junio C Hamano
2011-03-04 22:42 ` Junio C Hamano
2011-03-05 11:51 ` Colin Guthrie
2011-03-06 22:15 ` Junio C Hamano
2011-03-06 22:40 ` Junio C Hamano [this message]
2011-03-06 22:56 ` Jonathan Nieder
[not found] ` <AANLkTikctSrfqKCdeYUyvUmAZjr=i7kaFhPeB-LfwgUz@mail.gmail.com>
2011-03-09 10:31 ` [RFC/PATCH 0/2] i18n: add ngettext stub Jonathan Nieder
2011-03-09 10:46 ` [PATCH 1/2] i18n: add stub ngettext implementation Jonathan Nieder
2011-03-09 10:52 ` [PATCH 2/2] i18n: avoid conflict with ngettext from libintl Jonathan Nieder
2011-03-09 20:43 ` Junio C Hamano
2011-03-09 20:51 ` Jonathan Nieder
2011-03-09 20:55 ` Junio C Hamano
2011-03-10 3:17 ` [PATCH v2] i18n: add stub Q_() wrapper for ngettext Jonathan Nieder
2011-03-10 7:59 ` Junio C Hamano
2011-03-10 9:24 ` Ævar Arnfjörð Bjarmason
2011-03-10 9:21 ` [PATCH 2/2] i18n: avoid conflict with ngettext from libintl Ævar Arnfjörð Bjarmason
2011-03-06 22:15 ` [BUG] git-am silently applying patches incorrectly Junio C Hamano
2011-03-07 9:37 ` Colin Guthrie
2011-03-04 23:09 ` Alexander Miseler
2011-03-05 0:05 ` Junio C Hamano
2011-03-04 22:58 ` Junio C Hamano
2011-03-04 21:49 ` Drew Northup
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=7vhbbf50vu.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox$(echo .)com \
--cc=avarab@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=jrnieder@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox