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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <junio@xxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]