[PATCH] apply: remove lego in i18n string in gitdiff_verify_name
- From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Date
- May 8, 2012, 13:38 UTC
- Message-ID
- <1336484307-31553-1-git-send-email-pclouds@gmail.com>
- In-Reply-To
- <7vwr4n6fcj.fsf@alter.siamese.dyndns.org>
Currently it marks the string "...inconsistent %s filename..." where %s is either "old" or "new" from caller. From a translator point of view, nothing hints what "%s" may be. Make it two strings "...inconsistent new filename..." and "...inconsistent old filename..."
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
On Tue, May 8, 2012 at 1:00 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> diff --git a/builtin/apply.c b/builtin/apply.c
>> index 725712d..1edd3f7 100644
>> --- a/builtin/apply.c
>> +++ b/builtin/apply.c
>> @@ -919,7 +919,7 @@ static int gitdiff_hdrend(const char *line, struct patch *patch)
>> * their names against any previous information, just
>> * to make sure..
>> */
>> -static char *gitdiff_verify_name(const char *line, int isnull, char *orig_name, const char *oldnew)
>> +static char *gitdiff_verify_name(const char *line, int isnull, char *orig_name, int new)
>> {
>
> This change is unwarranted, though. The callers were much clearer when
> they passed "old" vs "new"; now they pass an unexplained 0 vs 1.Hmm.. how about this?
builtin/apply.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c index 725712d..92ba925 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -933,8 +933,15 @@ static char *gitdiff_verify_name(const char *line, int isnull, char *orig_name, if (isnull) die(_("git apply: bad git-diff - expected /dev/null, got %s on line %d"), name, linenr); another = find_name(line, NULL, p_value, TERM_TAB); - if (!another || memcmp(another, name, len + 1)) - die(_("git apply: bad git-diff - inconsistent %s filename on line %d"), oldnew, linenr); + if (!another || memcmp(another, name, len + 1)) { + if (!strcmp(oldnew, "old")) + die(_("git apply: bad git-diff - inconsistent old filename on line %d"), linenr); + else if (!strcmp(oldnew, "new")) + die(_("git apply: bad git-diff - inconsistent new filename on line %d"), linenr); + else + die("BUG: please add a new full string for '%s' similar to above code.\n" + "It makes translators' life much simpler. Thanks!", oldnew); + } free(another); return orig_name; }
-- 1.7.8.36.g69ee2